Question

Sorry if this is a stupid question but I've looked everywhere and can't find an answer.

I'm using mootools 1.2.5 Request.JSON to make an ajax request to return json data. It works fine in all browsers and returns valid json data (validated at http://jsonlint.com and http://jsonformatter.curiousconcept.com), but when trying the same script on an iPhone and logging the response I get 'null' with the following error -- TypeError: 'null' is not an object.

Any suggestions are very much appreciated. Thanks.

Here's a simplified version of the the request only asking for limit and limitstart:

var jsonRequest = new Request.JSON({
    method: 'get',                
    url: myurl,
    data:{
        'limit': 10,
        'limitstart': 0
    },
    onSuccess: function( response ) {
        if (/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {                
            console.log(response); // returns 'null' on iphone - only one tested so far
        }
        //otherwise, returns valid json on all web browsers and continues fine
        readMap( response );
    },
    onRequest: function () {
        $('loading_div').style.display="block";
    },
    onComplete: function(){
        $('loading_div').style.display="none";
    }
}).get();

and here's a snippet of the response returned in browsers, but only returns 'null' on iPhone:

[{"street_address":"My Street Address","id":"2","short_description":"asdf","city":"Seattle","price":"234.00","formattedprice":"$234.00\/week","totalcount":"1"}]

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top