Search code examples
phpjqueryajaxapacheinternal-server-error

Why is my ajax call resulting in this 500 error?


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.


Solution

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