Quote:
Originally Posted by anup.maverick
function A()
{
var Result;
Result = confirm('Are you sure want to continue?');
if(Result==true)
{
<% MyMethod()%>;
}
}
|
This ironically makes sense. <% MyMethod()%> is server side code and has to be processed by the server.
JS is only executed after the server has finished what it's doing, downloaded the resulting page to the user's web browser. That's when the
JS runs. So by the time the the
JS evaluates your if statement the MyMethod() call is sitting in IE or Firefox and it has no idea what to do with the server side code.
Depending on what you're trying to do you may be able to do something as simple as a postback. If that seems too big a response for what you want to do, than AJAX and the resources Imar listed can let you use a lighter touch.