Dear all,
I'm a beginer with Drupal.
I've created a page with a custom node (using a custom template) who's insert a SmartWizard on the page.
All is working fine except that I didn't know how to handle the submit in Drupal.
I've created a simple module.
I've implemented the mymodule_menu with :
<?php
$items = array();
$items['url/used'] = array(
'title' => t('Hello world'),
'type' => MENU_CALLBACK,
'page callback' => 'my_funct',
'access arguments' => array('access content'),
);
return $items;
?>
I've created the function my_funct :
<?php
function my_funct()
{
$firstname = (string)$_POST['firstname'];
drupal_set_message(t('Test ') + $firstname);
$data = array();
drupal_json_output($data);
}
?>
On the JS file, I've modified some lines :
function onFinishCallback(){
if(validateAllSteps()){
var datastr = 'firstname=' + jQuery("#firstname").val();
//jQuery('form').submit();
jQuery.ajax({
type: "POST",
url: "/url/used",
data: datastr,
cache: false,
success: ajaxCompleted,
});
}
}
function ajaxCompleted() { }
But no message (drupal_set_message) appears when I clicked on Finish.