2

This is the jQuery code

$( "input#go" ).click(function()
{
if($("input#datepicker").val()!="")
{
    $.ajax(
    {
        method: "POST",
        url: "http://acoroster.rf.gd/roster.php",
        data: { date : $("input#datepicker").val()},
        dataType: 'json',
        cache: false,
        success : function(result)
        {
            //code
        },
    });
}
else
{

}

});

This work perfectly in some mobile chrome browsers. but in some mobile Chrome browsers its doesn't work.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • what does it mean - ti doesn't work? What is the error you are getting? What is the console output? – shaggy Apr 29 '17 at 08:12
  • http://acoroster.rf.gd/acoroster.php This is the site. Select a date and press get roster. in some devices it works(in chrome). in some devices it doesn't give a response. In those devices which doesn't give a response, i tried it in the stock browser. then it works fine. so the problem might be with chrome. – Nadun Thilanka Apr 29 '17 at 08:18
  • I don't want link to your website. I want you to debug your code and tell us the result. – shaggy Apr 29 '17 at 08:28
  • i added an error function to $.ajax => error: function (jqXHR, exception). This gives the result jqXHR.status = 0 – Nadun Thilanka Apr 29 '17 at 09:58
  • no errors shown in chrome debugger – Nadun Thilanka Apr 29 '17 at 10:00
  • I am not sure if jqXHR.status should contain anything. On mobile chrome, is this condition `if($("input#datepicker").val()!="") {` executed? You need to debug if it is ajax problem or if it fails on something else. – shaggy Apr 29 '17 at 10:15
  • Object {readyState: 0, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…} – Nadun Thilanka Apr 29 '17 at 10:26
  • Above is the result i got in console log. => console.log(jqXHR); – Nadun Thilanka Apr 29 '17 at 10:27
  • When i used method GET instead of POST it worked fine all the browsers. In a article i read they have said jasonp should be used with POST. Any idea? – Nadun Thilanka May 03 '17 at 20:12

0 Answers0