tags:

views:

59

answers:

3
$("#ShowRating").html($.get(url));

This is not working, in fact firebug doesn't even show any headers... what am I doing wrong here?

+2  A: 

Try using $.load() instead:

$("#ShowRating").load("somepage.html");

Keep in mind too that Internet Explorer caches this request, so if you need to make this call again, it would be best to append some random characters on as a parameter.

Jonathan Sampson
thanks for that extra nugget about IE, this potentially saved me some time either in testing or in support tickets
shogun
+5  A: 

get doesn't return what you are getting (it is asynchronous). Try using load instead:

$("#ShowRating").load(url);
Marius
+4  A: 

As the others say, 'load' is a more direct way of doing what you are trying to do. But to show you a little more about how $.get works and why it isn't working in your example, here is how you would do it with $.get:

$.get(url, function(data) {
    $("#ShowRating").html(data);
});

Since $.get is asynchronous, the loading of the webpage did not wait for the GET request to return to fill in the data in the page. Instead, you pass in the callback function to handle the request result when the GET request actually completes.

BranTheMan