ASP.NET: Call codebehind if javascript doesnt exist in browser,Else javascript function
In asp.net page, How can i call the javascript methods for form processing-submitting if the user browser开发者_Go百科 supports javascript and use code behind events if the browser does not support javascript.I have the javascript code to send the form data to an ajax server page using jquery. Don't know how to invoke the needed one based on the browsers javascript availability
Create the form that does a postback and submits the data without JavaScript then set the click event on the submit button to call your javascript function. Then use e.peventDefault() and e.stopPropagation() in the click event to prevent postback.
You may also need to capture the enter key press event and prevent it from causing a post back as well.
精彩评论