Update multiple text boxes values with one AJAX Call


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Update multiple text boxes values with one AJAX Call

  1. #1
    Join Date
    Jul 2007
    Location
    Chicago
    Posts
    5

    Update multiple text boxes values with one AJAX Call

    I have a form which contains 1 drop down list abd 4 text boxes; the values for these boxes needs to be updated from the database based on the value from the drop down. Using the onreadystatechange you usually update the innerHTML to a div; how is it possible to update multiple values using the same method or is there other methods?

    Thanks

  2. #2
    Join Date
    Jul 2007
    Posts
    4
    How about grabbing the response text in one variable, then splitting that variable up into bits and then putting those bits into their respective text box.
    PHP Code:
    var someString pageRequest.responseText;
    ...
    var 
    temp someString.split(',');
    text1.value temp[0];
    text2.value temp[1];
    text3.value temp[2];
    text4.value temp[3]; 
    The response text would've been something like:
    thing1,thing2,thing3,thing4

    Assuming you're using PHP you could use the implode function to add those strings together.
    http://php.net/implode <-- Implode reference

    Sorry if I'm way off, I've been using PHP and Javascript for some time but I haven't been using AJAX very long at all.

Similar Threads

  1. Text file update Access Table
    By charligov in forum VB Classic
    Replies: 2
    Last Post: 01-22-2007, 12:00 PM
  2. text boxes
    By MacataQ in forum VB Classic
    Replies: 5
    Last Post: 05-01-2005, 04:43 AM
  3. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 12:45 PM
  4. reading multiple text files
    By simon in forum XML
    Replies: 6
    Last Post: 07-27-2001, 01:58 PM
  5. default value for text boxes.
    By david in forum ASP.NET
    Replies: 0
    Last Post: 08-02-2000, 02:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center