Using Jquery .ajax method how can i read the query parameter and hit the web method and get the result in json on page load + asp.net?
I am using Asp.net with jquery I wanted to display information for a specific 开发者_运维百科product that is getting from the query string so my question is
How can i get the query string through jquery and hit the Web method and get the result in json and display that result on my page on page load.
Thanks waiting for your replay..
You can parse the window.location.href in order to get the query parameter. See here for example. You then need to make an Ajax call in the document ready function:
$(function() {
// get query
// make ajax call
// get the results in json, display them
});
Because the results will load from the Ajax's method callback, they will appear slightly after the page has been loaded.
精彩评论