Domanda

I have an ajax call:

$.ajax({
    url: "http://localhost/kidsKnitsDB/edit.php",
    type: "post",
    data: id,
    beforeSend: function(response){alert('Sending');},
        success: function(response){ alert('success');},
        error: function(response){alert('failed');},
        complete: function(response){alert('finished');},
});

This result in a 500 server error that looks like this:

Request URL:    http://localhost/kidsKnitsDB/edit.php
Request Method:     POST
Status Code:    HTTP/1.0 500 Internal Server Error
Request Headers 17:09:44.000
X-Requested-With:   XMLHttpRequest
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0
Referer:    http://localhost/kidsKnitsDB/index.php
Pragma: no-cache
Host:   localhost
Content-Length: 0
Connection: keep-alive
Cache-Control:  no-cache
Accept-Language:    en-US,en;q=0.5
Accept-Encoding:    gzip, deflate
Accept: */*
Response Headers Δ4ms
X-Powered-By:   PHP/5.3.10-1ubuntu3.9
Vary:   Accept-Encoding
Server: Apache/2.2.22 (Ubuntu)
Date:   Sun, 26 Jan 2014 22:09:44 GMT
Content-Type:   text/html
Content-Length: 192
Content-Encoding:   gzip
Connection: close

If anyone call help, it'd be greatly appreciated, I'm unsure why I'd be getting this. Also I'm curious if the url attribute should be as it is or if it should be ../edit.php? I imagine the way I have it is correct so that apache can interpret the php.

È stato utile?

Soluzione

It was an undefined call in my php script that was the error. it was just a typo though.

Altri suggerimenti

What you will want to do is to check the server error logs. That will give you a good start in why the server encountered the error and where.

Due to it being a server side error don't try to guess what the problem is (is is the post data? Is it a code error?) Just look at the logs.

If you do not have a error log you may want to enable logging errors as explaind on the Apache website. (I cannot seem to paste a link so Google: "configuring Web log apache")

On Ubuntu the error logs are default on for the default v host and they resign at /var/log/apache2/

Happy debugging :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top