I have created a content type. I then alter the form of that content type to display extra button to save node using ajax:

$form['submit'] = array(
  '#type' => 'submit',
  '#ajax' => array(
    'callback' => 'MyModuleName_node_add_callback',
    'wrapper' => $form_state['node']->type . '-node-form',
    'name' => 'submit1',
  '#value' => t('Submit Me'),

I then display the form for creating this content type in another page using this code

function MYMODULENAME_node_form($type){
  module_load_include('inc', 'node', 'node.pages');
  $form = node_add($type); 
  return $form;

Now, the problem is that when i click on the button that i have created it shows me error this msg:

An AJAX HTTP error occurred.

HTTP Result Code: 500

Debugging information follows. Path: /path/system/ajax StatusText: Internal Server Error


Can you please help me fixing this problem??

Thanks in advance Mojo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.