5 Years
Discussion Span
Last Post by dinhunzvi

Have you tried calling the function with onblur then get the value to pass?

<input type="text" name="txtSearchPolicyNumber" id="txtSearchPolicyNumber" onblur="showResults();" />

When you perform the "onBlur", it will call the function, get the value and check to see if its blank.

function showResults() {
    var policynumber = document.getElementById("txtSearchPolicyNumber").value;
    if ( policynumber == "" ){
        alert("no number");
        document.getElementById("txtHint").innerHTML = "";
// and the rest of the code..

Also, in your php, just try running the sql statement without the table headers and just echo a single row. Just for testing purposes

require_once '../../moonlight/includes/mysql_connect.php';
$policyNumber = $_GET['pnumber']; 
// assign the $_GET['pnumber'] to $policyNumber

$sql = "SELECT * FROM paymentshistory WHERE policyNumber = '$policyNumber' ORDER BY dateCaptured DESC";
$result = mysql_query( $sql ) or die( mysql_error() . "<br />$sql" );
while( $row = mysql_fetch_array( $result ) ) {
    echo $row["policyNumber"];

what i would also try doing is type in the url code with a policy number to see if there are any errors on the php page.


if i hard code the policy number and run the getpaymenthistory i get the intended results. the problem is with the AJAX function.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.