この関数を入れても、アイテムをカートゾーンにドラッグするときに、配列に情報を入力する必要があります
var ProductInfo=new Array();
myGlobalArray=GetProductById(iProductId);
この Ajax 関数を呼び出す
function GetProductById(iProductId)
{
var ProductInfo=new Array();
console.log("2");
$.ajax({
type: 'POST',
url: 'services/ManageCategoriesServices.asmx/GetProductById',
dataType: 'xml',
'data': {'iProductId': iProductId },
success: function(data) {
source = null;
try
{
console.log("source product-> ",data.activeElement.childNodes);
myGlobalArray=TestProduct(data.activeElement.childNodes);
console.log("In Ajax myGlobalArray-> ",myGlobalArray); return myGlobalArray;
}
catch(e) {
$('#m_lblStatus').text('failed to read json');
}
},
fail: function() { $('#m_lblStatus').text('fail');}
});
return myGlobalArray;
}
myGlobalArray が必要な完全な情報を取得することを確認しましたが、配列をコピーしようとしたときに最初の関数に戻ると
myGlobalArray=GetProductById(iProductId);
それは空で、それは言う
子オブジェクトはありません
通常は機能しないため、グローバル配列を使用したため、グローバルは機能すると思いましたが、ajaxでは完全に表示されませんが、最初の関数では空になります。
In Ajax myGlobalArray-> ["medium_101-01-004-02.jpg", "303", "101-01-004-02", "44.95"]
After Ajax myGlobalArray-->[] There are no child objects
問題はどこだ?