The Ext. Ajax. Request request is complete and the return value is obtained.

Source: Internet
Author: User

The data name of the foreign key is displayed in a list for the apprentice today. However, the foreign key is composed of multiple data names. Therefore, the data is saved to and 2222, which are separated by commas.

However, the information of 111, 222, and needs to be displayed, so I will come to a for and go to ext in the background. ajax requests, 111, and 222 records need to be spliced at last, but I am using

Ext.Ajax.request ({ url: 'foo.php',   success: someFn,   failure: otherFn,   headers: {       'my-header': 'foo'   },   params: { foo: 'bar' }})

In this way, I want to process some data in the callback function of success, and then assign it to Ext. ajax. when a variable outside the request function is declared, it cannot be assigned a value. Use this. XXX is not acceptable.

So Id do

var sellContractNumStr="";               var sellContractNumArray = c.split(',');               for (var i = 0; i < sellContractNumArray.length; i++) {                   var conn = Ext.lib.Ajax.getConnectionObject().conn;                    conn.open("post", __ctxPath +'/erp/getQyPure.action?qyPureId='+sellContractNumArray[i],false);                     conn.send(null); if (conn.status == "200") {    var qyPure = Ext.util.JSON.decode(conn.responseText).data;    sellContractNumStr+='<span><a href="#" onclick="QyPureDetail.show(' + qyPure.qyPureId + ')">' +  qyPure.pureContact + '</a> | </span>'; }               }

This request method looks a little earthy. Haha

 var conn = Ext.lib.Ajax.getConnectionObject().conn;                    conn.open("post", __ctxPath +'/erp/getQyPure.action?qyPureId='+sellContractNumArray[i],false);                     conn.send(null); if (conn.status == "200") {    var qyPure = Ext.util.JSON.decode(conn.responseText).data;    sellContractNumStr+='<span><a href="#" onclick="QyPureDetail.show(' + qyPure.qyPureId + ')">' +  qyPure.pureContact + '</a> | </span>'; }

Continue learning.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.