开发者

Calling my web page from jQuery [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜