user2511140 user2511140 - 2 months ago 17
Ajax Question

ajax jquery post example error 503

When i click run button show this error in chrome console and don't alert anything

POST http://mysite/gd/add.php 503 (Service Unavailable)

enter image description here


<script src=""></script>
<body >
function go(){
$.ajax({ url: 'add.php',
data: {'q': ''},
type: 'post',
success: function(output) {
<button onclick="go();">Run</button>


<?php echo "Hello"; ?>


I have tried your code in local environment, it is working fine. The reason for 503 error because of the Web server (running the Web site) is currently unable to handle the HTTP request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. Some servers in this state may also simply refuse the socket connection, in which case a different error may be generated because the socket creation timed out.
user2511140 : I add this code to show server is to busy and show error.i changed server and problem solved

$.ajax({ url: 'add.php',
         type: 'post',
         data: {'q': ''},
         success: function(output) {
    error: function (request, status, error) {