简体   繁体   English

如何使用查询字符串从javascript调用aspx页面

[英]How to call aspx page from javascript with query string

Currently the functionality of a web app I am designing(I can not tell real details) is as follows : 目前,我正在设计的Web应用程序的功能(我无法说出真实的细节)如下:

alert('Hi');
var args = ShowModalDialogue(sURL,'','');
if(args[0] == 'Pass')
 alert('Bye');

Now I want to replace ShowModalDialogue with ModalPopupExtender. 现在,我想用ModalPopupExtender替换ShowModalDialogue。 But the problem is I don't know how I can call aspx page using Javascript/Jquery and how to return values to calling javascript in the form of array? 但是问题是我不知道如何使用Javascript / Jquery调用aspx页面以及如何以数组形式返回值以调用javascript?

Can anyone please help me out? 有人可以帮我吗?

Thanks in advance. 提前致谢。

You can use jquery to make an ajax call to your aspx. 您可以使用jquery对aspx进行ajax调用。

var query = 'value1'; var query ='value1';

$.ajax({
            type: "POST",
            url: "my_asp_file.aspx?q="+query,
            async: true,
            dataType: "json",
            data: data,
            success: function(response) {

var js_object = JSON.parse(response);



            },

            error: function() {



            }

        });

Then you can use JSON.parse() to convert the returned JSON element to a JS Object. 然后,您可以使用JSON.parse()将返回的JSON元素转换为JS对象。 Remember to convert the output of your query in ASPX to a JSON object (in your ASPX file). 切记将ASPX中查询的输出转换为JSON对象(在ASPX文件中)。

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

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