I want to post the following content through Ajax. How can I do this ?
<form method="post" action="http://supersaas.com/api/users">
<input type="hidden" id="account" value="robintest">
<input type="hidden" id="id" value="59fk">
<input type="hidden" id="user[name]" name="user[name]" value="[email protected]">
<input type="hidden" id="user[full_name]" name="user[full_name]" value="thomas">
<input type="hidden" id="user[phone]" name="user[phone]" value="">
<input type="hidden" id="user[address]" name="user[address]" value="">
<input type ="submit" name="submit" value="submit">
</form>
I tried the following code
$.ajax({
type: "post",
url: "http://http://www.supersaas.com/api/users",
data: {account:'sixcreeksTest', id:id,user[name]:name,user[address]:address}
}).done(function( result ) {
alert(result);
});
but this gives syntax error..
I need to pass the variables as such because I am passing to an SAAS. So I don't have control over the server.