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 9249823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:17:42+00:00 2026-06-18T10:17:42+00:00

Evening, I seem to have hit an issuee with submitting this html form via

  • 0

Evening, I seem to have hit an issuee with submitting this html form via a javascript onclick() function. This is my first time trying this, and i am new to js/ajax, however from my understanding of both i am doing this correctly… In the end this is my goal: user enters info – javascript/ajax constructs GET request and sends it – my php form runs each input field as its own query, every time the query is ran, it then echos the percentage of progress (after each query it runs) – which then (via the ajax) returns that percentage to my HTML5 progress bar (kudos to the new <prgress> tag.) and in turns creates a progress bar. however
1. I think i may be going about this wrong
2. the way im doing this should work
3. Im at the end of my rope…

here is my js:

function reply(){
 var total = document.getElementById("setName").name;
  var firstArray = new Array();
   for(i = 1; i <= total; i++){
    firstArray[] = "i = document.getElementById(i)";
   }
  //implode firstArray for uset in $_GET
  //aparently its called join...
  var GET = firstArray.join('&');

    //need to set up xml to run php for query
     if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
       xmlhttp = new XMLHttpRequest();
      }
     else
      {// code for IE6, IE5
       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }

     xmlhttp.onreadystatechange = function(){
       if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
         document.getElementById("progressBar").innerHTML = xmlhttp.responseText;
       }
     };
xmlhttp.open("GET","ajaxQuery.php?"+GET,true);
xmlhttp.send();
}

Again, I am new to js/ajax, but not PHP, running the querys is not a problem and that part is working flawless, but this wont even run the onclick…. any and all help is apreciated guys.

as a side note, my input fields use numbers as name attribute, to better interact with the js, but here is the onclick call

<button type = "button" onClick = "reply()">Submit</button>

I understand this could be A LOT better, feel free to tear it apart, the best way to learn is to be critisized on ones mistakes 🙂

  • 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-06-18T10:17:43+00:00Added an answer on June 18, 2026 at 10:17 am

    I tried to rewrite some of your code with jQuery. It should work, but I did not test it:

    <!--Import jQuery --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script> 
    <script type="text/javascript">
    
        $(function() {
            $("#submitButton").click(function(){
                reply();
            })
        });
    
        function reply(){
            var total = document.getElementById("setName").name;
            var firstArray = new Array();
            for(i = 1; i <= total; i++){
                firstArray[] = "i = document.getElementById(i)";
            }
            //implode firstArray for uset in $_GET
            //aparently its called join...
            var GET = firstArray.join('&');     
    
            var jqxhr = $.ajax( {
                type: "GET",
                url: "ajaxQuery.php?"+GET
            } )
            .done(function(data) { 
                $("#progressBar").html( data );    
            });
    
    
    
        }
    </script>
    
    <button type = "button" id="submitButton">Submit</button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Evening everyone. I seem to have hit an odd problem when trying to pass
Good evening, This is my 1st time on this site, I have been programming
Evening guys, This may seem like a stupid question but im having some issues
Evening, I came across this very useful post and I have everything looking good
Evening, I've no training in Databases, and I'm a bit lost. Essentially I've this
Evening, Is there a common or standardised name given to a function or method
Good evening, I'm having an issue with Masonry. This is all my relevant code:
Good evening, I would like to have a navigation bar which is centralised to
Good evening, In my app that I'm currently developing, I have a class that
I have a dataProvider that's defined with mx:XML like this. <mx:dataProvider> <mx:XML format=e4x> <root

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.