I have used three methods:
1. Add a hidden button to the page, define the event, and execute $ ("# Hide btnid"). Click () of js to execute the background method.
2. Use ajaxpro for execution
3. Use the URL of Ajax: page address/(static) method name for execution.
In this method, the method must be static. For example, on the _ default page, the example is as follows:
CopyCodeThe Code is as follows: public partial class _ default: system. Web. UI. Page
{
Static int svar = 1;
Int abc = 3;
Int result;
[Webmethod]
Public static string ajaxgetmethod ()
{
Svar = 2; // static variables can be called directly
_ Default d = new _ default (); // if it is not instantiated, result, ABC cannot be used.
Nostaticfun NSF = new nostaticfun (); // test is unavailable if it is not instantiated.
D. Result = NSF. Test ();
D. Result = D. ABC;
Return D. result;
}
}
Public class nostaticfun
{
Public int test ()
{
Return 2;
}
}
In this example, I have made a note. I 'd like to discuss with you any other better methods, or how you apply these methods.