views:

135

answers:

1

Is there a way to send a whole form's fields through a sajax function call? I think it is sajax anyway.

We are using Mediawiki and the function call is to "sajax_do_call(funcName,[params],callbackFuncName)"

I was just wondering if there was a way to jsut drop all fields from a form into params?

A: 

Unfortunately, I don't know a much about Mediawiki, but if you can add JQuery to your page then simply:

var myParams = $("form").serializeArray();

...will grab all the form values and create the param array for you.

To add JQuery you can either download JQuery core and include it in your page via <script> tag or include it via the Google hosted copy:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"&gt;&lt;/script&gt;

Manik