[jQuery] how to post to 2 different locations in jquery?
Hi, I would like to ask, how to post a form to 2 different locations
in jquery? i use this code but seems not working :
$(document).ready(function()
{
$("#contact").submit(function()
{
//var addresslines = doThing($('#address'))
//remove all the class add the messagebox classes and start fading
$
("#msgbox").removeClass().addClass('messagebox').text('Sending....').fadeIn(1000);
//check the username exists or not from ajax
$.post("registersent.php",{ name:$('#name').val(),'address':$
('#address').val(),'company':$('#Company').val()} ,function(data)
{
if(data=='yes')
{
$("#msgbox").fadeTo(200,0.1,function() //start fading the
messagebox
{
//add message and change the class of the box and start fading
$(this).html('Sending
registration').addClass('messageboxok').fadeTo(900,1,
function()
{
//redirect to cm page
document.location='http://xxx.com/?name='+$('#name').val()
+'&address='+$('#address).val()+'&company='+$('#Company').val();
});
});
}
else
{
$("#msgbox").fadeTo(200,0.1,function() //start fading the
messagebox
{
//add message and change the class of the box and start fading
$(this).html('Sending
failed').addClass('messageboxerror').fadeTo(900,1);
});
}
});
return false; //not to post the form physically
});
});
any solutions?
Cheers