JsonP works with Opera, Chrome and Safari?

On the website that I create, when logging in (since the database is on a different server) I use json padding to check if the user is the correct credentials.

It works flawlessly (ie7, ie8 and FF) until I tried it on chrome, safari and opera , where it is a complete disaster.

    $.ajax({
  type: "GET",
  dataType: "jsonp",
  url: "http://someurl.com",
  data: aRequestData,
  cache: false,
  error: function (XMLHttpRequest, textStatus, errorThrown) {
    // typically only one of textStatus or errorThrown
    // will have info
    alert("Error occured textStatus=" + textStatus + " errorThrown=" + errorThrown);
  },
  success: function(data) {
    alert('success');    
  }
});

Normal and simple, and it works in the browser window, however, to my great surprise, it did not work in chrome, safari and opera, and did not reach the warning of successful completion.

Does anyone know how to solve this problem?

Thanks.

+3
source share
2

html-, "Thickbox" ( jQuery Thickbox), ajax-!

Firefox IE , WebKit !

, .

!

0

Safari Chrome, , HTTP 200 ?

Chrome "", "", . , Safari. alt text

jQuery, , , 200 . , jQuery - , JSONP jQuery .

html :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title />
      <script type="text/javascript">
         function ws_results(obj) {
             alert(obj);
         }
      </script>
      <script type="text/javascript" src="http://someurl.com?foo=bar&amp;callback=ws_results" />
   </head>
   <body />
</html>
+1

Source: https://habr.com/ru/post/1725328/


All Articles