Note that there are some explanatory texts on larger screens.

plurals
  1. POCallback from client-side not working
    primarykey
    data
    text
    <p>I have html files clientside (part of a cross-platform app) that go out to the php file and need to get a varible or string back, it is correctly posting the data but not recieving it back.</p> <p>This is triggered on submit (client side .html):</p> <pre><code> var $form = $( this ), $submit = $form.find( 'button[type="submit"]' ), username_value = $form.find( 'input[name="username"]' ).val(), password_value = $form.find( 'input[name="password"]' ).val(), url = $form.attr('action'); /* Send the data using post */ $.post(url, {username: username_value, password: password_value},function (data) { alert(data); }); </code></pre> <p>this is the php file:</p> <pre><code>&lt;?php $username = $_POST['username']; $password = $_POST['password']; $DBusername = 'root'; $DBpassword = ''; $project = mysql_connect('localhost',$DBusername, $DBpassword); mysql_select_db('PickMeUpDatabase', $project); $sql="SELECT * FROM users WHERE username='$username' and password='$password'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ echo 'console.log("hi");'; $message = "saved successfully"; echo $message; } else { $sql = "Insert into users Values('me','myself','I','".$username."','Irene')"; mysql_query($sql); echo "Helooo"; } ?&gt; </code></pre> <p>I know the php file doesnt really make sense at this point I changed a lot for debugging, but the mysql query in the "else" statement is being passed and added to the database but the echo right below it isnt being returned to where it will be alerted in the html. In fact I can change the alert in the html to alert anything and it wont happen.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload