[jQuery] Re: JQuery Form Plugin and json

2008-09-12 Thread Stefan Sturm

Hello


 beforeSubmit: function(arr) {
var json = // ... build json string
arr.length = 0; // throw away current array contents (if you want)
arr[0] = { name: 'someName', value: json };
 }


thats it :-) Thanks...

Greetings,
Stefan Sturm


[jQuery] Re: JQuery Form Plugin and json

2008-09-11 Thread Mike Alsup

 Does jQuery provides a way to convert to JSON string?

 Felix Halim

There are plugins that provide that functionality.  This is a great
option as well:

http://www.json.org/json2.js

Mike



[jQuery] Re: JQuery Form Plugin and json

2008-09-11 Thread Alex Weber

Stefan,

Any particular reason why you'd want to do this??

Usually its the opposite... posting form fields normally (usually
easier to interpret by the server-side script) and then returning a
JSON object to jQuery, in which case you can use $.getJSON()

Alex

On Aug 29, 3:19 am, Stefan Sturm [EMAIL PROTECTED]
wrote:
 Hello,

 I'm using the jQuery Form PlugIn(http://www.malsup.com/jquery/form/)
 to handle my Forms. I like it, but I have a question about an
 improvment:
 At this time all form fields are send using post, but it wold be nice,
 to send all form fields json encoded as one post parameter.

 Is there a way to do this?

 Thanks and greetings,
 Stefan Sturm


[jQuery] Re: JQuery Form Plugin and json

2008-09-11 Thread Stefan Sturm

Hello,

thanks for your answer.
I made it the way you say. I build my json string in the beforeSubmit
function. So, now I have a correct json string, but how can I replace
the post array?
Sorry, but I hang at this point.

Thanks agin for your Help,
Stefan Sturm

2008/9/9 Mike Alsup [EMAIL PROTECTED]:


 It's not supported by the plugin, but you can hook the beforeSubmit
 event and change what is posted to the server.  beforeSubmit is passed
 an array of objects with name and value properties.  You could iterate
 over these, build your json string, and then replace the array
 contents with a single object that has name and value properties,
 where the value prop is the json string.

 Mike






 Mike



[jQuery] Re: JQuery Form Plugin and json

2008-09-11 Thread Mike Alsup

 thanks for your answer.
 I made it the way you say. I build my json string in the beforeSubmit
 function. So, now I have a correct json string, but how can I replace
 the post array?
 Sorry, but I hang at this point.

beforeSubmit: function(arr) {
var json = // ... build json string
arr.length = 0; // throw away current array contents (if you want)
arr[0] = { name: 'someName', value: json };
}


[jQuery] Re: JQuery Form Plugin and json

2008-09-10 Thread Felix Halim

Does jQuery provides a way to convert to JSON string?

Felix Halim

On Tue, Sep 9, 2008 at 10:22 PM, Mike Alsup [EMAIL PROTECTED] wrote:

  I'm using the jQuery Form PlugIn(http://www.malsup.com/jquery/form/)
  to handle my Forms. I like it, but I have a question about an
  improvment:
  At this time all form fields are send using post, but it wold be nice,
  to send all form fields json encoded as one post parameter.

  Is there a way to do this?

 I still searching for a solution for this...

 Hope, the developer is reading here :-)

 Greetings,
 Stefan Sturm


 It's not supported by the plugin, but you can hook the beforeSubmit
 event and change what is posted to the server.  beforeSubmit is passed
 an array of objects with name and value properties.  You could iterate
 over these, build your json string, and then replace the array
 contents with a single object that has name and value properties,
 where the value prop is the json string.

 Mike






 Mike



[jQuery] Re: JQuery Form Plugin and json

2008-09-09 Thread Stefan Sturm

Hello,

 I'm using the jQuery Form PlugIn( http://www.malsup.com/jquery/form/ )
 to handle my Forms. I like it, but I have a question about an
 improvment:
 At this time all form fields are send using post, but it wold be nice,
 to send all form fields json encoded as one post parameter.

 Is there a way to do this?

I still searching for a solution for this...

Hope, the developer is reading here :-)

Greetings,
Stefan Sturm


[jQuery] Re: JQuery Form Plugin and json

2008-09-09 Thread Mike Alsup

  I'm using the jQuery Form PlugIn(http://www.malsup.com/jquery/form/)
  to handle my Forms. I like it, but I have a question about an
  improvment:
  At this time all form fields are send using post, but it wold be nice,
  to send all form fields json encoded as one post parameter.

  Is there a way to do this?

 I still searching for a solution for this...

 Hope, the developer is reading here :-)

 Greetings,
 Stefan Sturm


It's not supported by the plugin, but you can hook the beforeSubmit
event and change what is posted to the server.  beforeSubmit is passed
an array of objects with name and value properties.  You could iterate
over these, build your json string, and then replace the array
contents with a single object that has name and value properties,
where the value prop is the json string.

Mike






Mike