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();
精彩评论