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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:47:35+00:00 2026-05-28T20:47:35+00:00

My javascript looks like that. There are some problems that I can’t figure out,

  • 0

My javascript looks like that.

There are some problems that I can’t figure out, where I did mistake

  • #status_message doesn’t show generated message
  • $("#status").className = 'fail'; doesn’t override current class

enter image description here

var message=$("#status_message"), form=$("#bcscan"), ids=$('#itemids'),proctype, destination, counter=0, tenWordCounter = 0, autoPostInterval=null, errorcount=0, successcount=0;

function ajaxPost() {
    formData = form.serialize()+'&process=Scan';    
    formUrl = form.attr('action');
    formMethod = form.attr('method');

    $.ajax({
        url: formUrl,
        type: formMethod,
        dataType: "json",
        data: formData,
        success: function (data) { 
            var now = new Date();
            if(data.err_detected==="yes")
            {     
                if(data.errors.indexOf(",") != -1)
                    errorcount=errorcount+data.errors.split(",").length;
                else errorcount=errorcount+1;                
                $("#status").className = 'fail';
                message =errorcount+" errors found";
                $('#errors').prepend(data.errors).slideDown("slow");                        
            }  
            $('#success').prepend(data.success).slideDown("slow");
            if(data.success.indexOf(",") != -1)
                successcount=successcount+data.errors.split(",").length;
            else successcount=successcount+1;              
            message +="Last submitted:"+now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
            $("#status_message").text(message); 
        }
    });   
}

Here is page in action

If you want to test, please choose some option from selects like, output from db, ebay.fr and press “scan”. Enter 10 digits seperated by comma try 41,42 (they exist in db tables) too between them. After 10th digit it will post textarea via ajax.

  • 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-28T20:47:36+00:00Added an answer on May 28, 2026 at 8:47 pm

    For the message, you’ve declared a jQuery object pointing at the element:

    var message = $('#status_message'), ...
    

    but then you’re overwriting it with a string:

    message = errorcount + ' errors found';
    

    You should be calling:

    message.text('some string...')
    

    to change its contents.

    For the class change, the correct syntax is:

    $("#status").addClass('fail');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation. I have some javascript that looks like this: function onSubmit()
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
It doesn't look like basic javascript but nor can I use JQuery commands like
We have received some JavaScript from an agency that looks wrong, but works. For
I've got a javascript snippet that displays a widget on my page. There's some
I have some code that looks something like this: <head runat="server"> <script type="text/javascript"> var
I have a javascript method looks like this JSMethod(JS_para_1,JS_para_2) { ...... ,,,,, } and
It looks like JavaScript does not have access to authentication cookies ('ASP.NET_SessionId', '.ASPXFORMSAUTH') in
I am converting a look-up table in PHP which looks like this to JavaScript
These ribbon in stackoverflow and uservoice.com looks nice. is there any javascript library/jquery plugin

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.