Post and Retrieve the same time using ajx
Hi,
I am using below code to post signup data using ajax but at the same time to get the registered data using json so it can be used by the browser.
- $.ajax({
- type: "POST",
- url: 'https://www.mydomain.com/ws/signup.php',
- data: formData,
- processData: false,
- contentType: false,
- }).done(function () {
- viewModel.loadPanelVisible(false);
- customer.insert({
- customer_id: data.Customer[0].customer_id,
- first_name: data.Customer[0].first_name,
- last_name: data.Customer[0].last_name,
- mobile: data.Customer[0].mobile,
- email_address: data.Customer[0].email_address,
- loggedon: false
- })
and in my php after finishing the signup I am doing this:
- $jsonData = '{ "Customer" :[';
- $jsonData .= '{"customer_id":"' . $customer_id;
- $jsonData .= '","customer_guid":"' . $customer_guid;
- $jsonData .= '","title":"' . $title;
- $jsonData .= '","first_name":"' . $first_name;
- $jsonData .= '","last_name":"' . $last_name;
- $jsonData .= '","gender":"' . $gender;
- $jsonData .= '","nationality":"' . $nationality;
- $jsonData .= '","birthday":"' . $birthday;
- $jsonData .= '","email_address":"' . $email_address;
- $jsonData .= '","mobile":"' . $mobile;
- $jsonData .= '"},';
- $jsonData = chop($jsonData, ",");
- $jsonData .= ']}';
- echo $jsonData;
How can I do this please.
Thanks,