Hi everyone,

I would like to use AJAX (to submit form data and get response) for a simple module I am developing. From the disscussion that has been going on in the forums I have learnt about the functions (HTTPPost, HTTPGet etc) available in misc/drupal.js. But I have no idea as how to implement these functions. Can anybody point me to a 'HOW TO' or else provide me some examples on how to use this functions.

Perhaps a handbook page in the module developers guide could be dedicated for this purpose as I believe many are eager to try AJAX with Drupal.

I saw some 'HOW TO' for using XAJAX/SAJAX libraries but since the above mentioned functions are already included I thought it will be better to use them ? Please let me know your ideas and suggestions.

Thanks

Karthik

Comments

nedjo’s picture

Good suggestion for a handbook page, I've started one (http://drupal.org/node/42403, draft only visible to admins as yet) and will make it viewable when it's useful.

nedjo’s picture

Okay, I've roughed in some tips and guidelines at http://drupal.org/node/42403. It's still pretty rough, but may provide some useful hints.

ponkarthik’s picture

Your handbook page was very informative. But I am at a loss as how to use the 'HTTPPost' method to submit a form.

Can you please provide an example on how to use the 'HTTPPost' method to submit form values and how to access them in the module's handler function

Thanks

Karthik

Thox’s picture

Just checking up on all the Ajax threads that I may have misssed in the past. It would be nice if HTTPPost could submit a form automatically and handle all the extras by itself, but it currently doesn't.

You would currently need to create a JS object containing name->value pairs of the form elements and their values.