Reputation: 12846
This bug is really frustrating me and I am hoping the fine folks here at SO can help at least give me some clues as to what to look for. I have set up an order tracking system using ajax and it works with like 95% of the requests. However some are running the function that is in the error response.. for example :
function trackIt(){
$j("#result").html(" ");
$j("resultTwo").html(" ");
var ordervalue = $j('#order').val();
if ((ordervalue.length == 9) || (ordervalue.length == 5)) {
$j.ajax({
type: 'GET',
url: '<?php echo Mage::getBaseUrl('web') ?>/index/trackOrder',
data: 'increment_id='+ ordervalue,
dataType: 'json',
beforeSend: function() {
$j('#result').html('<img src="loading.gif" alt="" />');
},
success: tracker,
error : function (xhr, status, error) {
wtf();
}
});
} else { return false; };
};
I can see in firebug that the json data is returning as it should but for a couple of tracking numbers it is running the wtf function?! WTF? What else can I look for? Why is it considering some requests an error? What can I look for? Is there something wrong with how I am making these requests? Let me know if you need more information or anything to help you help me.
Thanks in advance for any help.. all I want for Christmas is for this damn thing to work!
Edit :
Here is an example of the JSON response that is not being returned.
{"Debug":"3","Status":"Closed","Date":"2011-12-15T22:53:09","Description": "<div class=\"orderProduct\">Sector 9 J-Bay Bamboo Longboard - Color: ASSORTED, Size: 10</div><div class=\"orderProduct\">Kahuna Haka Cruiser Skateboard - Color: ASSORTED, Size: ONE SIZE</div><div class=\"orderProduct\">Santa Cruz Primo Pintail 9.9" Longboard Cruiser - Color: ASSORTED, Size: ONE SIZE","ProcessorId":"0","Sku": "16389400070018<br>17748800070018<br>18777606960012","Method":"Free Shipping","ShippingCo":"UPS Ground","Track":""}
Here is an example of one that is being returned.
{"Debug":"1","Status":"Closed","Date":"2011-12-15T22:33:32","Description": "<div class=\"orderProduct\">Supra Dixon Black Canvas Shoe - Color: BLACK, Size: 12","ProcessorId":"0","Sku": "16086200010046","Method":"Ship To Store - In Store Pickup","ShippingCo":"Ship To Store - In Store Pickup","Track":"1Z68W0376038395"}
One obvious difference is that debug value which unfortunately I have no idea what that means.
Upvotes: 0
Views: 106
Reputation: 707976
Your example of JSON that causes the error is invalid JSON. Right around here:
>Santa Cruz Primo Pintail 9.9" Longboard Cruiser - Color:
it goes wrong.
I'm not sure exactly what it's supposed to be, but I would presume the JSON parser is throwing an error because of the bad JSON.
Upvotes: 1