Michael Itzoe
Michael Itzoe

Reputation: 1957

How to parse Json object in ASP classic passed from jQuery

Using a jQuery dialog, on clicking 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.

Upvotes: 0

Views: 2139

Answers (2)

Gabriele Petrioli
Gabriele Petrioli

Reputation: 196142

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")

Upvotes: 3

lambacck
lambacck

Reputation: 9926

jQuery will default to sending the data as regular form parameters, not JSON.

Upvotes: 1

Related Questions