How to parse Json object in ASP classic passed from jQuery
Using a jQuery dialog, on clic开发者_StackOverflowking OK I call $.post( "save.asp", { id: 1, value: "abcxyz" } );
to pass the values to my ASP classic file that will update the database. I don't need a return value (unless it fails).
I'm a relative noob to jQuery, so I'm assuming I'm using JSON to pass the values to the ASP file. I just don't know what to do with them in ASP (using VBScript). I've seen things like ASP Extreme, but I'm not clear on how to use them. I've tried referencing values via the Request collection, but no luck. All I want to do is take the values passed, parse them out, then save them to the database.
Sorry if this is a duplicate, but this just isn't clicking for me.
You are using associative arrays (as they are called in javascript in PHP, Object Literal Notation in javascript), but since you use them as the data to the post
method they should get treated like normal form submits..
so in the asp side
pId = request.form("id")
pValue = request.form("value")
jQuery will default to sending the data as regular form parameters, not JSON.
精彩评论