Reputation: 1207
i want to call page content using $.get method that will call a page(.ascx) and render page content into div in current page(aspx) i have used something like this... didin't work..
<script type="text/javascript">
function calltemp1() {
var result = '';
$get("/Views/Templates/_Temp1.ascx",result)
$("#RecentstoryDiv").html(result);
}
</script>
above script gives jscript runtime error "object expected".
Upvotes: 0
Views: 2326
Reputation: 36130
$.get
and not $get
$.get
is missing its ending semi-column$.get
is a callback, not a variable to be filled. You need to pass a function that will be passed the content as a parameterHere is a working example:
$.get("/Views/Templates/_Temp1.ascx", function(result)
{
$("#RecentstoryDiv").html(result);
});
But you will be better using the load
method
$("#RecentstoryDiv").load("/Views/Templates/_Temp1.ascx");
Upvotes: 2
Reputation: 6643
use the load() function instead
$("#RecentstoryDiv").load('/Views/Templates/_Temp1.ascx');
See the documentation here: http://docs.jquery.com/Ajax/load#urldatacallback
Upvotes: 2