0

This is my code and it works well in FF 41.0.2, GC 46.0, IE 11 and Opera 33, I haven't tried it in Safari yet. The problem is this is not working in FF version 37 and 38. Is there any thing I need to change or add to make this code compatible with as much as possible all browser and versions?

------------jsonp.php-------------------

  $.ajax({
         url : "http://www.sample.sample.ph/sample.php",
         dataType:"jsonp",
         jsonp:"mycallback",
         success:function(data)
          {
           alert(data.status);                                          
          }
        });

------------sample.php-------------------

$callback ='mycallback';
if(isset($_GET['mycallback'])) {
    $callback = $_GET['mycallback'];
}   
$arr =array();
$arr['status']="success";   
echo $callback.'(' . json_encode($arr) . ')';
aabejero
  • 113
  • 9
  • 1
    Please refer the following to see if this resolving your issue. http://stackoverflow.com/questions/298745/how-do-i-send-a-cross-domain-post-request-via-javascript – Baskar Rao Nov 06 '15 at 02:19

2 Answers2

0

I checked the computers having the problem and I got this in the console:

reference error $ is not defined

I found out that <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> is being blocked by Firefox. When I'm trying to load Google CDN in a New Tab in FF, it says "This Connection is Untrusted" and "I Understand the Risk" option is not available.

So I therefore conclude it's not the browser version having issue nor jQuery code, it's the browser blocking jQuery Google CDN. I'll try if this page helps https://support.mozilla.org/en-US/kb/connection-untrusted-error-message.

aabejero
  • 113
  • 9
0

Self-hosted jQuery solved the issue.

aabejero
  • 113
  • 9