简体   繁体   English

等待__doPostBack()函数完成

[英]waiting for __doPostBack() function to complete

I don't have the source code of a web application in .Net neither the access to the database. 我没有.Net中Web应用程序的源代码,也没有对数据库的访问权限。

And with Greasemonkey I use JavaScript. 使用Greasemonkey,我使用JavaScript。

In the source code of HTML I have : 在HTML的源代码中,我有:

<input ... onclick="javascript:__doPostBack('ctl00$MidContent$GridView4','Page$10')">

So in greasmonkey script I put 所以我在greasmonkey脚本中

__doPostBack('ctl00$MidContent$GridView4','Page$10');
/* others instructions */

But the others instructions doesn't wait the __doPostBack() function to complete. 但是其他指令不会等待__doPostBack()函数完成。

I want nothing to execute until the __doPostBack() have not finish. 在__doPostBack()尚未完成之前,我什么也不想执行。

PS: I'm not good at .NET just with JavaScript PS:我不擅长JavaScript。

This is a good way: 这是一个好方法:

$.ajax({
        type: "POST",
        data: 
        {
            '__EVENTTARGET': '<%=YourButtonName.ClientID %>'
        }
    }).done(function (data) {
        alert("ok");
    }).fail(function (p1, p2, p3) {
        alert("error");
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM