Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Joseph_H_
Beginner
118 Views

Ajax to Web Service not working

Jump to solution

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..

Tags (2)
0 Kudos
1 Solution
3 Replies
Joseph_H_
Beginner
118 Views

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

Thank You...

Michael_O_2
New Contributor I
118 Views

Fantastic. This solved my issue.

Reply