/    Sign up×
Community /Pin to ProfileBookmark

Send Javascript Eval() string to classic ASP page via POST

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”}]’ + ‘)’);[/CODE]

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;
}[/CODE]

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
%>[/CODE]

Any suggestions would help me a great deal and be appreciated. Thanks in advance, NickG

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@007JulienJul 31.2013 — You will probably solve your question with JSON and ASP, search for this words...
Copy linkTweet thisAlerts:
@NickG21authorAug 01.2013 — I've done that pretty extensively through google, this forum and stackoverflow.com and have not had any luck. Nobody seems to be able to give me any help on code, just on generic search terms, I assure you i've pretty much exhausted my generic searching and feel like I haven't made any progress, has nobody ever used the .POST() method to send an eval() string in classic asp. I agree it's outdated, and if I had a choice I would not be using this method, but sadly I don't.
Copy linkTweet thisAlerts:
@007JulienAug 01.2013 — Your eval seems wrong. It build a javascript object, useless for a POST !

Send simply the original string (or a JSON.stringify(tempOrders) to test with an alert(JSON.stringify(tempOrders)). Then work with ASP ...
×

Success!

Help @NickG21 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...