Can't get JSON data as text from jquery url for phonegap application?

I use this code to get data as text from a SOAP web service, for example:

$(document).ready(function () {

    $("#btn").click(  function () {
        alert("s");
          $.ajax({
              url: 'http://magicmap.skmm.gov.my/McmcServicemain_bb.asmx/Login?UserName=navdeep@gmail.com&Password=abc',
              dataType: "text",
              async: true,
              success: function (result) {
                  alert(result);
              },
              error: function (request,error) {
                  alert('Network error has occurred please try again!'+request +error);
              }
          });    

    });
});

Here, if I change the URL and use the same JSON using the JSON GENERATOR , it works well and returns data fine.

Is there a difference in these two URLs, please help me, I am stuck here from 2 days. I am new to jQuery. Thanks

+4
source share
1 answer

The URL json-generator.comworks because it supports Cross Resource Resource Sharing . It sets the response header:

Access-Control-Allow-Origin: *

, . URL- CORS, .

URL , script - Same Origin .

+4

All Articles