Scarface
Scarface

Reputation: 3923

jquery GET adds current url to my url parameter

I have a GET request in a document. The current page I am on includes that document and then the document is executed. The issue is the document is found when included but the GET request is not because the request that is being sent by GET (according to firebug) is http://www.site.com/watch/http//www.site.com/file/doc.php when the request should just be requested by GET to http//www.site.com/file/doc.php. The current page I am on is http://www.site.com/watch/123456 where watch is an alias for video.php?vid_id=. Anyone have any ideas as to why this is happening?

         $.getJSON("http//www.site.com/file/doc.php?action=view&load=initial&page="+page+"&vid_id="+vid_id+"&username="+username+"&t=" + (new Date()), function(json) {  
  var html = '';
  for(i=0; i < json.length; i++) {
    html += prepare(json[i]);
  }
  $('#shoutbox-list').append(html).find('li').fadeIn(1500);
   $('div[id="chunk"]').fadeIn(1500);
});

Upvotes: 0

Views: 200

Answers (1)

Dexter
Dexter

Reputation: 18452

You just need to insert a colon into your URL so that it's a valid resource identifier:

e.g. change:

$.getJSON("http//www.site.com/....

to

$.getJSON("http://www.site.com/....
               ^

Upvotes: 2

Related Questions