500 Internal Server Error - All Ajax calls, PHP

ajax, internal, php

Solution

I've finally got to the bottom of this. In fact there was nothing wrong with the code. However, I did have a plugin that wasn't being found during bootstrapping. This was then being run through my error handler which was changing the header to a 500. Once I'd removed the unfound plugin everything was fine.

Stupid mistake to make I suppose!

Problem

Issue I'm receiving the same error (500 Internal Server error) for all AJAX calls on a site I'm developing on my localhost (WAMP). I'm beginning to think that it might be the way my server is set up. Maybe I'm missing a PHP extension or something? Any help would be much appreciated. Testing I know the code works fine because i've navigated to the ajax action on my browser. Also the code actually saves data to the database so I know it's finding the correct script and running it ok. Code I've simplified the code to make testing easier. JS ``` $.ajax({type: 'GET', url: '/cms/performances/deleteperformance', data: 'id=' + id, dataType: 'json', success: function(result) { switch(result) { case 1: //Refresh the page location.reload(); break; case 0: alert('error'); break; case 2: alert('Incorrect call'); break; default: alert('default'); break; } }, error: function(xhr, ajaxOptions, thrownError) { var httpCode = xhr.status; alert(httpCode + ': ' + thrownError); } }); ``` PHP ``` public function deleteperformanceAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); echo json_encode(1); } ```

Original source