php - SyntaxError: Unexpected token S -


i'm stumped. i'm doing simple ajax form user enter data , send data server.

i've got following code:

<?php require("/mnt/library/configdb.php");         require("/mnt/library/accessdb.php");  db_config_utility(); db_connect();  //assign passed parameters $submitdate = $_post['submitdate']; $mname      = $_post['mname']; $mid        = $_post['mid']; $coffice    = $_post['coffice']; $street     = $_post['street']; $city       = $_post['city']; $state      = $_post['state']; $zipcode    = $_post['zipcode']; $lat        = $_post['lat']; $lng        = $_post['lng'];  //setting sql call $sql="insert manholes(     submit_date,     manhole_name,      manhole_id,      central_office,      street,     city,     state,     zipcode,     latitude,     longitude     )     values (     '$submitdate',     '$mname',     '$mid',     '$coffice',     '$street',     '$city',     '$state',     '$zipcode',     '$lat',     '$lng'     )";      echo("sql: " . $sql);  //making sql calls mysql_query($sql); ?> 

the data getting server correctly echo prints out correctly. server sends code 200 not place data database. causes ajax post fall error function "syntaxerror: unexpected token s".

if remove echo error thrown "syntaxerror: unexpected end of input"

any advice on how find causing problem?

the unexpected token s because you're echoing text, ajax isn't expecting response. removing causes other error because you're not sending anything. should check see ajax function expects receive (json?) and, after running query, echo correct response ajax knows successful.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -