cancel
Showing results for 
Search instead for 
Did you mean: 

Ajax not returning json response for cart

SOLVED

Ajax not returning json response for cart

I am stuck with what seems tobe a core issue to me.

 

When placing an order, no matter which module I use, the server accepts the order it s placed and created but the json response is never returned, in fact the server sends no response at all, not even a code. I dont understand why its not working because I can verify the result is being set with an error log statement but, no matter what I try I cannot get the server to respond. All three modules have similar functionality and the same function names. The other ajax functions IE saveBilling, etc work as expected, just placeOrder fails for some reason. even though they all use the same function to display the results.

 

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

 

Any help or hints to get me looking in the right place would be greatly appreciated.

 

Info:

Magento CE 1.9.1.2

 

Modules

Stock 1 page

Firecheckout

One Step Checkout

public function placeOrderAction(){
ini_set("error_reporting", E_ALL);
error_reporting(-1);
error_log("place order");

/**
* a bunch of code depending on the module
*/

//$this->_render($result);
//$this->_render(json_encode($result));
//$this->getResponse()->sendResponse();
//die(json_encode($result));

//$result["success"] = true;
//$this->getResponse()->clearHeaders()->setHeader('Content-type','application/json',true);
//$this->getResponse()->setBody(json_encode($result));
//$this->getResponse()->sendResponse();
error_log("MESSAGES: ".json_encode($result));
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
//$this->getResponse()->sendResponse();
//return $this;
//die();
//exit;
}

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Ajax not returning json response for cart

I am not exactly sure why, but apparently cursing did the trick.

 

$result = array('success' => "f%^&%^ You", 'error'=> "Mutha f&654#4");

I recieved an error response and check out has worked fine ever since...............

View solution in original post

5 REPLIES 5

Re: Ajax not returning json response for cart

$result is not defined when you comment those code out, you can init it as

$result = array('success' => true, 'error'=> false);

for testing if this is what the fronend expect.

 

what do you mean by no response at all? not event 200 or 400 response code? request status is always pending in chorme developer tool net work tab?

Re: Ajax not returning json response for cart

$result is defined and properly set I can confirm that with the error_log statement

 

No response code not 200 not 500 not anything, firebug it just stays grey, chrome displays the no response page no headers no anything but the code executes properly, the order is created and paid for, emails are sent

Re: Ajax not returning json response for cart

can you run that place order url in browser directly?  maybe infinite redirect or timeout?

Re: Ajax not returning json response for cart

I can't place it in the browser directly because it must be POST, and I dont really know how, but curl -vvv from the command line sent this back:

 

< HTTP/1.1 100 Continue
* Empty reply from server
* Connection #0 to host www.website.com left intact
curl: (52) Empty reply from server

Re: Ajax not returning json response for cart

I am not exactly sure why, but apparently cursing did the trick.

 

$result = array('success' => "f%^&%^ You", 'error'=> "Mutha f&654#4");

I recieved an error response and check out has worked fine ever since...............