I'm newbie to jQuery mobile 1.4.3 and javascript, I'm trying to register a new user sending an AJAX Post call to the a web service and I'm lost...
The user registration has to send the following JSON to the web service:
{
"userName": "sample string 1",
"email": "sample string 2",
"password": "sample string 3",
"confirmPassword": "sample string 4",
"name": "sample string 5",
"deviceId": "sample string 6"
}
The web service url: http://company.ac-web-systems.eu/api/account/register
My AJAX code:
var formData = {
"userName": "user1",
"email": "email@mail.com",
"password": "123456",
"confirmPassword": "123456",
"name": "name1",
"deviceId": "12121212121212"
};
// process the form
$.ajax({
type: 'POST',
crossDomain: true,
url: 'http://compay.ac-web-systems.eu/api/account/register',
data: formData, // our data object
dataType: 'json', // what type of data do we expect back from the server
encode: true
})
// using the done promise callback
.done(function (data) {
// log data to the console so we can see
console.log(data);
// here we will handle errors and validation messages
});
I'm pretty sure the dataForm data structure or the way the data is assembled isn't correct.
I also need some advice if this is the correct way to connect to a web service or is there another better and faster option for jQuery mobile?
Really need a help here.
Thanks in Advance.
UPDATE
I can't seem to reach the service here is the real url: http://yolp.ac-web-systems.eu/api/account/register