Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made one function in .aspx page. This function return 0 or 1. This function i have to call from a JavaScript file. How to do this?
Posted
Updated 13-Feb-13 19:20pm
v2

You can't directly call the function from JS. This is because JS gets executed at the client side ASP.NET at the server side. You need to send AJAX request from JS to aspx page which will then call the desired function. Return value can be send back in the response which JS can process.
 
Share this answer
 
Comments
Member 9511889 14-Feb-13 1:24am    
how to send AJAX request from JS to aspx page
hi,

Use ajax for that, one method is to call webservice from the browser.

Check these links :-
http://www.dotnetcurry.com/ShowArticle.aspx?ID=109[^]
http://stackoverflow.com/questions/9919052/calling-aspx-cs-method-from-javascript[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900