Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 14, 2012 03:25 PM by BrockAllen
Member
341 Points
308 Posts
Apr 14, 2012 01:26 PM|LINK
hi
i have a page called Default.aspx and call Default2.aspx with ajax below like :
$.ajax({ type: "Post", contentType: "application/json; charset=utf-8", url: "Default2.aspx", success: function (data) { $("#tabs-1").html(data); } });
and in Default2.aspx i have a asp button that have a event
when i click on button my event run and redirect to Default2.aspx
but i don't redirect to Default2.aspx and remain into Default.aspx
please help me how to solve it
All-Star
28072 Points
4996 Posts
MVP
Apr 14, 2012 01:28 PM|LINK
In the form submit event handler you need to prevent the browser from performing its default action.
$("#theForm").submit(function(e) {
e.preventDefault();
});
Edit: should be form not button -- it's better that way
Apr 14, 2012 01:36 PM|LINK
thanks for your answer
please more help me or show me with sample
thanks
Apr 14, 2012 03:25 PM|LINK
I'm not sure what else you need -- before you call $.ajax, make sure you call e.preventDefault in the javascript event handler callback function.
vahid bakkhi
Member
341 Points
308 Posts
problem in use from runat in use ajax
Apr 14, 2012 01:26 PM|LINK
hi
i have a page called Default.aspx and call Default2.aspx with ajax below like :
$.ajax({
type: "Post",
contentType: "application/json; charset=utf-8",
url: "Default2.aspx",
success: function (data) {
$("#tabs-1").html(data);
}
});
and in Default2.aspx i have a asp button that have a event
when i click on button my event run and redirect to Default2.aspx
but i don't redirect to Default2.aspx and remain into Default.aspx
please help me how to solve it
BrockAllen
All-Star
28072 Points
4996 Posts
MVP
Re: problem in use from runat in use ajax
Apr 14, 2012 01:28 PM|LINK
In the form submit event handler you need to prevent the browser from performing its default action.
$("#theForm").submit(function(e) {
e.preventDefault();
});
Edit: should be form not button -- it's better that way
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
vahid bakkhi
Member
341 Points
308 Posts
Re: problem in use from runat in use ajax
Apr 14, 2012 01:36 PM|LINK
thanks for your answer
please more help me or show me with sample
thanks
BrockAllen
All-Star
28072 Points
4996 Posts
MVP
Re: problem in use from runat in use ajax
Apr 14, 2012 03:25 PM|LINK
I'm not sure what else you need -- before you call $.ajax, make sure you call e.preventDefault in the javascript event handler callback function.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/