Send some parameters to the same page using jquery.ajax
hi folks
I use jquery and it gives me error : "Microsoft JScript runtime error: 'url' is null or not an object" when I use "$.ajax(window.开发者_高级运维location.href");" inside window.location.href is like this : "http://localaddress/mypage.aspx?id=2" How I can solve it ?$.ajax()
takes an object with options, like this:
$.ajax({ url: window.location.href });
If you just want to fetch a URL, use $.get()
like this:
$.get(window.location.href);
It's one of the $.ajax()
shorthand methods, if you want to send parameters, it looks like this:
$.get("mypage.aspx", { id: 2 });
//or long-hand
$.ajax({ url: "mypage.aspx", data: { id: 2 }});
精彩评论