Hi,

I'm trying to execute code within callback ajax and I received this error javascript "Error javascript Uncaught TypeError: Cannot read property 'apply' of undefined",

The callback ajax contains the following code:

function eweev_edit_update_callback($form, &$form_state){

$data = drupal_json_encode(array( "selector_button_edit" => "ATRIBUTE1", "form" => "ATRIBUTE2");
$commands[] = ajax_command_invoke(NULL, "claim_edit_update", array($data));
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}

But when I added node_save() to the code the error javascript disappear and all things work properly:

function eweev_edit_update_callback($form, &$form_state){
$node = node_load(ID);
node_save(node);

$data = drupal_json_encode(array( "selector_button_edit" => "ATRIBUTE1", "form" => "ATRIBUTE2");
$commands[] = ajax_command_invoke(NULL, "claim_edit_update", array($data));
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}

Can anybody help me out with this?

Thanks!

Comments

Snater’s picture

Priority: Major » Normal
Status: Active » Closed (outdated)

Closing because quite some time old. Feel free to reopen if the issue still exists. As to the issue description, the issue does not seem to be related to the Insert module though.