Hi,
Why I am getting parseerror when I am not returning anything and I am just INSERTing?
here is the code:
- $('#frmSurvey').submit(function (event)
- {
- event.preventDefault();
-
- viewModel.loadPanelVisible(true);
- var formData = new FormData();
- formData.append("customer_name", $("#txtName").dxTextBox('option', 'value'));
- formData.append("customer_email", $("#txtEmail").dxTextBox('option', 'value'));
- // formData.append("customer_birthday", $("#dateBirthday").dxDateBox('option', 'value'));
- $.ajax({
- type: "POST",
- url: 'http://www.meskholdings.com/temp/submit_survey.php',
- data: formData,
- processData: false,
- contentType: false,
- }).done(function ()
- {
- viewModel.loadPanelVisible(false);
- DevExpress.ui.dialog.alert('Thank you for your feedback!', 'Thanks');
- Survey.app.navigate("home");
- }).fail(function (jqXHR, message)
- {
- // $("#txtLoginName").dxTextBox('instance').option('value', '');
- // $("#txtPassword").dxTextBox('instance').option('value', '');
- viewModel.loadPanelVisible(false);
- DevExpress.ui.dialog.alert(message, 'Error');
- })
- });
this is my PHP:
- <?php
- header("Content-Type: application/json");
-
- if (isset($_SERVER['HTTP_ORIGIN'])) {
- header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
- header('Access-Control-Allow-Credentials: true');
- header('Access-Control-Max-Age: 86400'); // cache for 1 day
- }
-
- $customer_name = $_POST["customer_name"];
- $customer_email = $_POST['customer_email'];
-
- $mysql_host = "mysql:host=999.999.999.999;dbname=survey";
- $mysql_user = "root";
- $mysql_password = "xxxxxxxxx";
- $mysql_options = array
- (
- PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
- );
-
- // $mysql_connection;
- $mysql_connection = new PDO($mysql_host, $mysql_user, $mysql_password, $mysql_options);
- $mysql_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $mysql_query = $mysql_connection->prepare('CALL sp_save_customer_survey(:param_customer_name)');
- $mysql_query->bindParam(':param_customer_name', $customer_name, PDO::PARAM_STR);
-
- $mysql_query->execute();
- ?>
Thanks,
Jassim