By DrupalOnFire on
Hi all,
I would like to know how I can pass multiple values from client side to server and read them using php. I know the approach is AJAX but I don't have any clear idea how to the above task correctly
var dati = new Array();
dati['name'] = $('input#edit-field-testing1-0-value').val();
dati['name1'] = $('input#edit-field-testing2-0-value').val();
$(window).bind("load", function() {
$.ajax({
url: 'ajax_example/process',
type: 'POST',
data: dati,
success: function(msg){
$('input#edit-field-testing2-0-value').val(msg);
}
});
});
if I do the above thing how can I read those data in php? Thanks
Comments
You have to use hook_menu()
You have to use hook_menu() to register a callback path. In this callback path, you will put your PHP code.
Contact me to contract me for D7 -> D10/11 migrations.
This page has information
This page has information about hook_menu. Read this article http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_menu/6. This will help you.