Sam,

Instead of $.get()... I'd use $.ajax().

Check out this post from Brian Ronk <http://groups.google.com/group/jquery-en/browse_frm/thread/ec2eca0746d2d5f4/37389139ca16ab64?lnk=gst&q=getJSON%28%29+or+post%28%29+parameter+question&rnum=1#37389139ca16ab64> on basically the same subject.

Read my reply (#3), and see if that doesn't help. And while it doesn't talk about it, you can also pass arguments as a query string (without the leading '?'). The 'data' parameter of the $.ajax function would be something like:

   data: "MyVar1=" + myJSVar1 + "MyVar2=SomeConstantString";

as opposed to:

   data: {"MyVar1":myJSVar1, "MyVar2":"SomeConstantString"}

Also the in-built supported dataTypes in the $.ajax() function are: html, json, xml, and script.

Hope this helps. :o)

Cheers,
Chris

SamCKayak wrote:
I did a little Json and some XML using prototype last year.  Now I
have jQuery and need to pass about 4 string parameters to the server,
query a database, and return about 4 string parameters.

My current method to post the get is:

$.get("../survey/postsurveytodb.asp", {
                surveyid:       strSurveyId,
                question:       strQuestion,
                type:   strChoiceType,
                choices:        strParmChoices
        },
        function(data){ /* The callback on Ajax Request Complete */
                alert("Data Loaded: " + data);
        }
);

I am not familiar with any built-in Json support jQuery may have, so
the above method of passing parameters to the server seemed to be
efficent for this request.  ASP can pick apart the query string
neatly.

Json comes to mind when contemplating decoding the return data.  Which
would be easier?  Encoding the data as a query string or as Json.

Suggestions or comments?

Sam



--
http://www.cjordan.us

Reply via email to