Hello all,
I've had a look around but couldn't find an answer to my question.
I'm trying to submit a form using the javascript .submit() function but it doesn't seem to want to work. I'm using Ajax to get a value from a database and put it into a hidden field called destination and then want to submit the form.
Here is my code. The function is called by a button input.
[CODE=javascript]function getDestination( )
{
var dest = $('destination' );
var form = $('hotel_search ');
var destUrl = 'getDestination .php';
var params = 'destinationNam e=' + $('destinationN ame').value;
var ajax = new Ajax.Request
(
destUrl,
{
method: 'post',
postBody: params,
onSuccess:
function(transp ort)
{
var response = transport.respo nseText || '';
dest.value = response;
form.submit();
},
onFailure:
function()
{
alert('Somethin g went wrong...');
}
}
);
}[/CODE]
I've had a look around but couldn't find an answer to my question.
I'm trying to submit a form using the javascript .submit() function but it doesn't seem to want to work. I'm using Ajax to get a value from a database and put it into a hidden field called destination and then want to submit the form.
Here is my code. The function is called by a button input.
[CODE=javascript]function getDestination( )
{
var dest = $('destination' );
var form = $('hotel_search ');
var destUrl = 'getDestination .php';
var params = 'destinationNam e=' + $('destinationN ame').value;
var ajax = new Ajax.Request
(
destUrl,
{
method: 'post',
postBody: params,
onSuccess:
function(transp ort)
{
var response = transport.respo nseText || '';
dest.value = response;
form.submit();
},
onFailure:
function()
{
alert('Somethin g went wrong...');
}
}
);
}[/CODE]
Comment