Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 420083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:50:28+00:00 2026-05-12T18:50:28+00:00

I have a series of dynamically generated inputs that I need to have ajax

  • 0

I have a series of dynamically generated inputs that I need to have ajax update in a php file for me once the user clicks off of the input.

I think I have the right code, but it’s not working for reasons beyond my understanding. I’m a complete javascript/ajax noob, so be gentle.

The js/ajax:

<script type="text/javascript"> 
// Initialize the object:
var ajax = false;

// Create the object...

// Choose object type based upon what's supported:
if (window.XMLHttpRequest) {

    // IE 7, Mozilla, Safari, Firefox, Opera, most browsers:
    ajax = new XMLHttpRequest();

} else if (window.ActiveXObject) { // Older IE browsers

    // Create type Msxml2.XMLHTTP, if possible:
    try {
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e1) { // Create the older type instead:
        try {
            ajax = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e2) { }
    }

}
function update_program(row, target, value) {
    if (ajax) { // Confirm that the object is usable
        ajax.open('get', 'update.php?row=' + encodeURIComponent(row) + '&target=' + encodeURIComponent(target) + '&nfv=' + encodeURIComponent(value)); // Call the PHP script using GET, pass the variable
        //ajax.onreadystatechange = handle_programupdate; // Function that handles the response
        ajax.send(null); // Send the request
    }
}
</script>

And the php for the dynamic input fields

echo "<td><input type=text value=\"$value\" name=\"date\" onblur=\"update_program($i, $j, this.input.date.value);\" class=med></td></td>";

The row count is $i, and the field count is $j. So the data I need sent is the row, field(target), and the modified value of the input.

The inputs are arranged in a table there are many many (varying rows, 63 fields). Each field is either a text input, or in one case a text area. How can I make them submit to the php file after the user alters them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:50:28+00:00Added an answer on May 12, 2026 at 6:50 pm

    I think this part in the onclick in the input

    update_program($i, $j, this.input.date.value)
    

    should be

    update_program($i, $j, this.value)
    

    Also, consider using jQuery, it makes ajax much easier. And everything else too 😛

    function update_program(row, target, value) {
        $.get('update.php', {row:row, target:target, nfv:value});
    }
    

    Also, you are using time and your parameter is value in the function, right?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page in which controls are dynamically generated as the user navigates
I have taken over a CodeIgniter PHP site that dynamically generates resized images and
I have a series of select dropboxes setup, with content that dynamically updates depending
I have a series of dynamically created GridViews that I load. Everything works fine
I have to dynamically create series of links that when clicked - change some
I have a series of horizontal div boxes that I need to add the
I have a form field (a series of checkboxes) that's being created dynamically from
I have a series of color variables for my site that are numbered off:
I have a series of PHP page, and I would like to use conditional
I have a series of logging breakpoints in Xcode4 that I'm using to selectively

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.