Null response in PHP AJAX call

neo_Zero

New Member
I have a working login script on another site that loads a PHP script via AJAX. I can't seem to figure out why I am getting a null response when it should either be simply false or an array of values. When I manually put the values into the php script (hard coded) it working. I can see in the console that the variables are being sent from the form. However, nothing is being returned. Can anyone spot what I am missing?Thanks for any help or ideas.Login PHP\[code\]<?php $login = $_POST['login'];$password = $_POST['password'];require_once("DB.php");$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); mysql_select_db($db) or die ("Unable to select database!"); $query = "SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'";$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); if (mysql_num_rows($result) > 0) { $output = "true"; while(list($member_id, $firstname, $lastname, $login, $passwd, $City, $State, $bday, $approved, $organization, $school, $trainingdate, $Subscriber, $wscoordinator, $Position, $subdate, $enddate, $notice, $book, $trial) = mysql_fetch_row($result)) { echo json_encode(array('memberid' => $member_id, 'firstname' => $firstname, lastname => $lastname, approved => $approved, subscriber => $Subscriber, position => $Position, school => $school, login => $login, book =>$book, ws => $wscoordinator, trial => $trial, enddate => $enddate));}} else {$output = "false";echo json_encode($output);}?>\[/code\]AJAX, using jQuery.\[code\]$('#loginForm #loginButton').click(function(){ var $form = $('#loginForm'), $inputs = $form.find("input"), serializedData = http://stackoverflow.com/questions/11361262/$form.serialize(); var login = $('#login').text(''); var password = $('#password').text(''); $.ajax({ type: 'POST', url: 'Scripts/php/login.php', data: serializedData, success: function(response){ console.log("Response: "+response); if(response != "false") { //window.location.href='http://stackoverflow.com/questions/11361262/toolstart.html'; $.cookie('lastname', response.lastname, { expires: 365, path: '/' }); } else { alert("Your email and password combination did not match."); } }, dataType: 'json'}); \[/code\](Yes, I know I need to move from MD5; just haven't gotten there yet.)
 
Top