I'm trying to create dynamic table rows, I did it using jquery, but when I'm trying to save the form values never works, because you should first declare such fields before.
Maybe in the future I can find a better answer, today I'm newbie.
My question for today is, how can I send my information array serialized (http://docs.jquery.com/Ajax/serializeArray), to my_module function ?
first my module code:
function my_module_menu() {
$items['capture.json'] = array(
'title' => 'Capture',
'page callback' => 'my_module_saving_info',
'access arguments' => array('access content'),
//'page arguments' => array(1),
'type' => MENU_CALLBACK,
);
return $items;
}
function my_module_saving_info() {
global $_GET;
db_query("UPDATE {my_module1_table} SET description= '%s' "
."WHERE vid = '7' ",
$_GET['description'],
);
}
----------------------------------------------------------
my idea is when the function "capturingFieldFormvalues" is called then I get the form values and send them to "my_module_saving_info" function.
capturingFieldFormvalues = function() {
var fields = $(":input").serializeArray();
$.get(Drupal.settings.my_module.capture_url,fields, function(data) {
alert(data);
}); // End inline function
} // End savingInfo function
----------------------------------------------------------
but I don't know how to get the "data" in my php function.
If you are an expert and you have a minute to solve this problem, please help me!.
For you, it could takes you 3 minutes to tell me what's wrong on my side, for me could take days, lol.
Many thanks
Best
Comments
The answer is "AHAH"
The answer is "AHAH" (really), see: http://drupal.org/node/348475.
You might also want to checkout the AHAH Helper module.
You also might try a Google search on
drupal.org: AHAHoops!
I made a mistake!..
I forgot to add
drupal_add_js(
array('my_module' => array("capture_url" => $capture_url) ),'setting');
that's why that code was not working, anyway thanks! for your suggest, I will check ahah, sounds great!.
Thanks