SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Mar 2007
    0 Post(s)
    0 Thread(s)

    Php pages and ajax

    I'm trying to create a page that pulls values from sql and puts them into a table within a form. I have been using an ajax script that i have to listen for changes to items within the page.

    anyways, each row of the sql result gets put into a row on the table and each row has 1 textfield with ids of textfield[num] where num starts at 0 and goes to the number of rows in the table - 1. im wondering how to make the ajax script listen to all of them without having to put a million objects in the script since they number of rows will be different each time the page is called. can i have it listen to textfield[] as if it's an array?

    if that is not possible, can you tell me any other ideas of how to make this work?

    Thanks in advance.

    here is the code i would like called after any textfield[] box is changed.
    // JavaScript Document
    Event.observe(window, 'load', init, false);
    function init(){
    	 $('updateButton').style.display = 'none';
    	 Event.observe('quantity','change', updateCart, false);
     function updateCart(){
    	var url = 'updateCart.php';
    	var pars = 'itemID='+escape($F('itemID'))+'&quantity='+escape($F('quantity'));
    	var target = 'cartDiv';
    	var myAjax = new Ajax.Updater(target,url, {method: 'get',parameters: pars});
    Last edited by LHOR; Apr 13, 2007 at 01:24. Reason: added code


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts