Software Archive
Read-only legacy content
17061 Discussions

ajax Post / Get doesn't work in App Preview and Build

Andreas_W_
Beginner
183 Views

I'm aware that there are several threads concerning this topic but since I tried the different approaches to solve this problem without succeeding I'll post the description of the problem in my specific case.

Ajax-calls work perfectly using the Simulate-Tab in Intel XDK-IDE.

In App-Preview and in the Build-Version the ajax-call fails with readyState: 0, status: 0 and statusText: "error". Nontheless, the responseText contains exactly the correct answer that I'm expecting from the server.

I tried different calls like $.post or $.ajax with type: "POST". I don't think it's a CORS-Problem as I'm getting the correct Text in responseText.

The current implementation:

$.ajax({
        type: "GET",
        url: config.serverUrl + "/myPage",
        data: JSON.stringify(data)
    })
    .done(function( resp ) {
        if(resp.state != "success")
                return false;
            else{
                //Success!! go party
                //window.location.href = "some-other-page.html";
            }
    })
    .fail(function(e, status, error){
       alert(e.responseText + "\n" + e.statusText + "\n" + error);
    });

 

 

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
183 Views
0 Kudos
Reply