Welcome to the iMore Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread AuthorThread Author   #1  
    Thommsn's Avatar
    iPhone Nanite

    1 Posts

    Default http request with mobile Safari


    I am using the following javascript code:

    var data = 'anyData';  
    var req = new XMLHttpRequest(); 
    req.open("POST", url, true);  
    req.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");  
    req.onreadystatechange = function(){  
        if (req.readyState == 4 && req.status == 200) {  
    (url: localhost)

    When i open my website with the Safari everything is working (the data("anyData") is send to my web-server). I am testing this using the Axis TCP Monitor.
    But if i open the same site with the iPhone Simulator or a "real" iPhone the data gets lost.

    Are were any difference between Safari and mobile Safari?
    or is my Javascript code wrong? or is a httprequest like this not allowed with the iPhone?

    Any ideas will be very welcome.(i tried different frameworks to do the httprequest and nearly every existing sample)

    Thanks a lot.

Posting Permissions