APP Error loading link using jquery .load()

  • 1
  • Problem
  • Updated 3 years ago
  • Not a Problem
Hi guys,

I am using the following sdk version.

with Phonegap/Cordova: 2.9

So basically I'm using jquery .load() to load a certain div from a website to my app which works, the problem comes in when someone presses any link in my case the login button.

the error is: net::ERR_FILE_NOT_FOUND (file:///android_asset/www/Track)

Here is my JS:
$(document).ready(function() {
$('#gtse').load("http://aurora.gizmogps.com/track/Track .accountLoginContentTable");
})'

the link it goes to is actually a query string link which looks like this:
http://aurora.gizmogps.com/track/Trac...

I'm no expert but to me it sounds like the app is trying to look for the continuing link locally, is there something I'm missing to avoid this? I also know there is an inappbrowser plugin for phonegap/cordova would that be a better solution for my problem?

Thank you,
Mike

Photo of Mike Nowosielski

Mike Nowosielski

  • 2 Posts
  • 0 Reply Likes

Posted 5 years ago

  • 1
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
You may want to confirm that the code $('#gtse').load("http://aurora.gizmogps.com/track/Track .accountLoginContentTable"); works even on a browser. Also, check whether the domain name aurora.gizmogps.com is whitelisted.

-yiming
Photo of Mike Nowosielski

Mike Nowosielski

  • 2 Posts
  • 0 Reply Likes
yes, so in my "config xml" I do have, <access origin="*"/> setup up. My browser from my laptop won't even load the initial Login screen like it does on the phone, because of a access control error from my domain.
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
Can you try again, replacing the space in the URL with "%20"?

-yiming
Photo of TrumpRCoder

TrumpRCoder

  • 1 Post
  • 0 Reply Likes
If you are using jQuery Load method to fetch a div content then you should give the div's id in the .load() url. You can see how it is done in the jQuery Load example here.   

The code which you have written should be like this:
$(document).ready(function() { 
$('#gtse').load("http://aurora.gizmogps.com/track/Track?page=menu.top#myDivId"); 
});
Here myDivId is the id of the div in your page.

If you don't provide the div's id, then the .load() method will give you the whole page content.