I have a javascript array created through an eval() that I want to send to a classic asp page, I believe through a .Post() (but am happy to go whatever route is best). I am not aware on how to do this at all and all of my attempts have been futile. If anyone can help me with the below code, it would be greatly appreciated. This is the javascript variable setup:
[CODE]var tempOrders = eval(‘(‘ + ‘[{AccountOverride: {Id:”-9223372036854775808″, Name:””, Number:””, HHID:”-9223372036854775808″, HHName:””, Registration:””, RepId:””, Source:””, ‘ +
‘Status:”0″, IsDeliveryVsPayment:”False”, IsEmployee:”False”, IsManaged:”False”, IsOnMargin:”False”, OptionStatus:””, OptionAgreement:””}, ‘ +
‘Id:”-9223372036854775808″, ‘ +
‘Action:””, ‘ +
‘Type:”0″, ‘ +
‘ProductOverride: {Symbol:””, AssetClass:””, Cusip:””, HasShortTermRedemptionFee:”False”, HasTicker:”False”, Id:”-9223372036854775808″, Name:””, Type:”None”, AssetType:””, AssetSubtype:””}, ‘ +
‘QuantityType:””, ‘ +
‘Quantity:””, ‘ +
‘PriceType:””, ‘ +
‘PriceTypeAmount:”0″, ‘ +
‘ExchangeSymbol:””, ‘ +
‘Condition:””, ‘ +
‘AcceptingRepId:””, ‘ +
‘DateReceived:””, ‘ +
‘TimeReceived:””, ‘ +
‘CommissionCharge:””, ‘ +
‘CommissionAmount:”0″, ‘ +
‘ConfirmNote:””, ‘ +
‘DivCapGain:””, ‘ +
‘Breakpoint:”0″, ‘ +
‘BuyPrice:””, ‘ +
‘SellWaiver:””, ‘ +
‘PositionType:””, ‘ +
‘SpecialCondition:””, ‘ +
‘TimeInForce:””, ‘ +
‘WaiveFee:”False”, ‘ +
‘RolloverCusip:””, ‘ +
‘RemoveTrade:”False”, ‘ +
‘Index:””, ‘ +
‘TimePriceDiscretionaryOverride:”False”}]’ + ‘)’);
Values end up being placed in this in some backend JQuery, and after that is set, a function is called, where I want to then send this information back to a different classic .asp page to be displayed to the user.
[CODE]function SendOrdersToParent() {
if (tempOrders[0][‘ProductOverride’][‘Id’] == ‘-9223372036854775808’) {
if (!ValidateInitialFields()) return false;
}
if (window.opener && (typeof window.opener.OrderCreated != ‘undefined’)) {
// adding this logic to disable multiple orders being created.
if (!creatingOrder) {
creatingOrder = true;
window.opener.OrderCreated(tempOrders);
}
}
//for(var i = 0; i < tempOrders.length; i++){
// tempOrders[i][‘AccountOverride’][‘Number’] = “123456”;
// tempOrders[i][‘QuantityType’] = “D”;
// $(“#arrayTemp”).append(tempOrders[i][‘Quantity’] + ‘ : ‘ + tempOrders[i][‘AccountOverride’][‘Number’] + ‘<br/>’);
//}
var obj = JSON.parse(tempOrders);
$.ajax({
type: “POST”,
traditional: true,
url: “Overview.asp”,
data: JSON.stringify(obj),
cache: false,
success: function(){
$(“#arrayTemp”).append(“Successful Post”);
},
error: function(){
alert(“Unsuccessful post”);
}
});
//window.close();
return false;
}
The overview.asp page will handle it and just display the data on the screen, i’ll do some styling to it and everything, but basically overview.asp would have something like this on it;
[CODE]<%
dim arrayVals
arrayVals = request.form(“tempOrders”)
if arrayVals <> “” then
response.write “returned : ” & tempOrders
end if
%>
Any suggestions would help me a great deal and be appreciated. Thanks in advance, NickG