Heim  >  Artikel  >  Web-Frontend  >  Jquery和JS用外部变量获取Ajax返回的参数值的方法实例(超简单)_javascript技巧

Jquery和JS用外部变量获取Ajax返回的参数值的方法实例(超简单)_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:32:101348Durchsuche

以前只知道在返回data区域赋给html控件值,后来发现,原来直接定义变量就行了。
 

复制代码 代码如下:

 var csj_data;

      $.ajax
       ({
           cache: false,
           async: false,
           type: 'post',
           data: { aaa: "1" },
           url: "../handle/Ladder_Fee_Code.ashx?ajaxaction=Select_FangAn",
           success: function (data) {

 
               csj_data = data;
               alert(data);
           }
       });

alert(csj_data);
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn