Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery State Pending
    primarykey
    data
    text
    <p>I'm experiencing a bit of a strange behaviour when making an ajax request with Jquery, the request stays forever in 'pending' state.</p> <p>As you can see I AM getting the 200 Ok status back, but I have no idea what else it wants.</p> <p>Any help would be appretiated.</p> <p>Its a very simple GET request:</p> <pre><code>function validateZipcode(event){ definitionObj = j(this).data("definition"); url = baseUrl+"/address/ajax/validateZip/zipcode/"+this.value; ajaxObj = j.ajax({url: url,success:function(result){ handleValidateZip(result.evalJSON(),definitionObj); }}); } ` </code></pre> <p>Raw HTTP response headers are as follows:</p> <pre><code>HTTP/1.1 200 OK Date: Wed, 11 Dec 2013 05:30:30 GMT Server: Apache/2.4.4 (Unix) PHP/5.4.19 OpenSSL/1.0.1e mod_perl/2.0.8-dev Perl/v5.16.3 X-Powered-By: PHP/5.4.19 Set-Cookie: DBGSESSID=1%3Bd%3D1%2Cp%3D0; path=/; version=1 frontend=1jtnhn5g02vt7nhvmm0ekomb55; expires=Wed, 11-Dec-2013 06:30:31 GMT; path=/somePath; domain=SomeDomain.com; httponly Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache P3p: CP="CAO PSA OUR" Status: 200 OK Content-Length: 96 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: application/json </code></pre> <p>And the contents follows: <code>{"city":"N\/A","state":"DISTRITO FEDERAL","colonies":["HERMANOS SERDAN","PERIODISTA"],"ok":true}</code></p> <p><strong>EDIT:</strong> I don't think the server side code is relevant in this case, but here it is:</p> <pre><code> class GattacaWebLab_Addressvalidation_AjaxController extends Mage_Core_Controller_Front_Action { /** * Returns a JSON object with the state corresponding to the zip and cities that belong to the zip * @throws Exception */ public function validateZipAction() { $zipcode=$this-&gt;getRequest()-&gt;getParam('zipcode'); $colonyCollection = Mage::getModel('addressvalidation/colony')-&gt;getCollection(); $colonyCollection-&gt;addFieldToFilter('ZIP', $zipcode); $cityName=$colonyCollection-&gt;getFirstItem()-&gt;getCity()-&gt;getData('CIUDAD'); $stateName=$colonyCollection-&gt;getFirstItem()-&gt;getState()-&gt;getData('ESTADO'); $colonies = array(); foreach($colonyCollection as $colony) { $colonies[]=$colony-&gt;getData('COLONIA'); } if(sizeof($colonies)&gt;0) $response = array('city' =&gt; $cityName, 'state' =&gt; $stateName, 'colonies'=&gt;$colonies, 'ok' =&gt; true, ); else $response = array('ok'=&gt;false); $response=Mage::helper('core')-&gt;jsonEncode($response); $this-&gt;getResponse() -&gt;setHeader("Status","200 OK",true) -&gt;setHeader('Content-Type', 'application/json') -&gt;setBody($response); //And voilá mon ami! C'est fini } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload