0

I'm running my Cordova app through the browser.

And when it needs to send an ajax request, it does so to a partially escaped URL.
http://192.168.8.100:3000/proxy/https%3A%2F%2Fqz.com%2Fpostqr

I have tried encoding the URI, tried serializing, yet the same behavior can be seen. The browser is Chrome running on Windows.

Code in question:

var url = "https://qz.com/postqr";
    var data = {payload:results,user:user};
    $.ajax({
        type: "POST",
        url: url,
        data: data
    }).fail(function(data){
        console.log('ERROR SUBMITTING RES');
        console.log(data);
    }).done(function(data) {
                console.log('SUBMITTING RES');
console.log(data);
    });

```

Edit: the solutions provided on SO are not fixing the issue for me.

Igor Q.
  • 686
  • 10
  • 21
  • Possible duplicate of [URL Encode a string in jQuery for an AJAX request](http://stackoverflow.com/questions/6544564/url-encode-a-string-in-jquery-for-an-ajax-request) – Script47 Jun 30 '16 at 15:10
  • Script47 - i tried suggestions from that page, and they did not work. I even mentioned it in the question. – Igor Q. Jun 30 '16 at 18:16

1 Answers1

0

The issue is not programmatical, but rather in how Phonegap works.

The Phonegap Developer Programm has issues with connecting to outside hosts.

To resolve the issue - navigate to the folder of the project and type

phonegap serve

and everything will work just fine. Even with the special chars being escaped in the url.

Igor Q.
  • 686
  • 10
  • 21