Software Archive
Read-only legacy content
17061 Discussions

Ajax to Web Service not working

Joseph_H_
Beginner
510 Views

I started a Bootstrap Cordova 5.4.1 project.

I can access the web service through the emulator. 

I can't access the web service testing on my device through the xdk app.

I've added <meta http-equiv="Content-Security-Policy" content="connect-src *">

And also made sure the Cordova app settings are correct.

I still can't access the web service.  I can manually type the web service address in the browser on the device and it comes up.

I've exhausted my search through forums and can seem to find a solution.

Here is my .js file

$(document).ready(function () {
    $("#connect").click(function(){
        
        $("#results").html("Just Clicked...");
        var postData = "{}";
        $.ajax({
            type: "POST",
            url: "http://webservice.schhca.com/Hello.asmx/HelloWorld",
            //data: postData,
            contentType: "application/json",
            crossDomain:"true",
            dataType: "json",
            success: function (msg) {        
                $("#results").html(msg.d)
            },
            error: function(xhr, ts){
                $("#results").html(xhr.status + "<br />" + xhr.statusText + "<br />" + xhr.responseText + "<br />" + ts);
                
            }
        });
    });
});

Any help would be appreciated...

Thank You..

0 Kudos
1 Solution
3 Replies
Joseph_H_
Beginner
510 Views

Yes, It is working with jquery 2.0... I had another .js library that was loading an older version of jquery

Thank You...

0 Kudos
Michael_O_2
New Contributor I
510 Views

Fantastic. This solved my issue.

0 Kudos
Reply