开发者

Calling my web page from jQuery [duplicate]

开发者 https://www.devze.com 2023-03-15 03:28 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How can I call a new web page from javascript / jQuery
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How can I call a new web page from javascript / jQuery

I just asked a question about how to do this and had some suggestions. Here's the code that I came up with:

$('#CreateButton').click(function (event) {
 event.preventDefault
 var datastore = $("#SelectedDatastore").val();
 var answer = $("#SelectedAnswer").val();
 wi开发者_JS百科ndow.location = "/adminTasks/Create?datastore=" + datastore + "&selectedAnswer=" + answer;
});

Can someone confirm this is okay and there's no optimization needed.

Is there any difference if I use document.location.href ?


All looks good apart from it should be event.preventDefault();

0

精彩评论

暂无评论...
验证码 换一张
取 消