I need a Drupal form to submit a file to an external server using ajax. I have done the form using Form API and I am able to submit it via Ajax, But the Drupal throbber never stops and I am not able to get the returned value. But in firebug I can see it to be returned.
My Code:
function upload_video_episode($form, &$form_state){
$form['files'] = array(
'#type' => 'file',
'#title' => t('Video'),
'#description' => t('Upload a file, allowed extensions: mov, mp4, avi, mkv'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#ajax' => array(
'path' => url('http://web.com/test.php', array('external' => true)),
'callback' => 'upload_video_test',
),
);
$form['#action'] = url('http://198.199.95.235:8080/dev/test.php', array('external' => true));
return $form;
}
function upload_video_test(){
return "Done!";
}
The throbber just keep rotating non-stop.
However, in firebug I can see the form have been submitted and values returned.
Console seems to be showing some error, possibly related to Non-Origin. But in my case the data is already submitted.
Error: Permission denied to access property 'document'
- Is what I have done so far correct?
- I want to get the returned value and store it in a hidden form field or something.
- Or is Drupal Form API not capable of handling external urls?
Any help would be highly appreciated.