Jump to content

Search the Community

Showing results for tags 'jqueryajax'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I am new to php coding.I am trying to send a textbox value(invoice number) to a php file through juery and ajax.From php file I am returning the json encoded data.I want to display the Values fetched from database in the following textboxes(Total Amount,Balance Amount) and select boxes(Payment mode,Payment status). I am not getting the output I wished.Please can any one suggest me where I am going wrong.Any help is much appreciated. I have pasted my code below HTML <form name="inv_payment" method="post" action="" style="margin:0px;width:400px;"> <fieldset> <legend>Payment details</legend> <label for=inv_num>Invoice Number</label> <input id=inv_num name=inv_num type=number placeholder="12345" required autofocus > <input type=button name="get_details" id="get_details" value="Get Details" > <label for=tot_amt>Total Amount</label> <input id=tot_amt name=tot_amt type=text placeholder="12345" disabled > <br/> <label for=pay_up>Pay Up </label> <input id=pay_up name=pay_up type=text placeholder="12345" required ><br/> <label for=bal_amt>Balance Amount </label> <input id=bal_amt name=bal_amt type=text placeholder="12345" disabled > <br/> <label id="paymt_mode"><strong>Payment Mode</strong></label> <select name="pay_mode" style="width: 130px"> <option selected="selected">Cash</option> <option>Cheque</option> </select><br/> <label id="paymt_status"><strong>Payment Status</strong> </label> <select name="pay_status" style="width: 130px"> <option selected="selected">Pending</option> <option>Completed</option> </select><br/> <input type="submit" value="Payment" name="pay_btn"> </fieldset> </form> Jquery <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#get_details').click(function() { //To pass the invoice number and fetch related details $.getJSON("get_invpay_details.php", {id: $('#inv_num').val()}, function(data){ $('#tot_amt').val(data['Total_Amount']); $('#bal_amt').val(data['Balance_Amount']); $('#pay_mode').val(data['Payment_Type']); $('#pay_status').val(data['Payment_Status']); }); }); </script> PHP <?php include('includes/dbfunctions.php'); include('includes/db.php'); if(isset($_GET['id'])) { $tmp = $_GET['id']; $sql = mysql_query("select Total_Amount,Balance_Amount,Payment_Type,Payment_Status from invoice where InvoiceNum='$tmp'"); if(mysql_num_rows($sql)) { $data = mysql_fetch_array($sql); echo json_encode($data); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.