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

  • Home
  • SEARCH
  • 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 3605288
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:06:17+00:00 2026-05-18T21:06:17+00:00

i want to show some data from DB. and i’m use ajax to do

  • 0

i want to show some data from DB. and i’m use ajax to do that.
But something wrong is happen, the can’t show after i have changed some jquery script in my page.

which part of following script that caused my page not show the result:

$("#model").change(function() {
             var barcode;
             barCode=$("#model").val();
             var data1 = $("#model").val(barCode.substr(0,barCode.length-8));
             var data2 = $("#serial").val(barCode.substr(barCode.length-8,8));
             var str= data1;
             var matches=str.match(/[TEJUG2]\D*D/i);
         $.ajax({
                  type:"post",
                  url:"process1.php",
                  data:"tversion="+matches+"&action=tunermatches",
                  cache:false,
                  async:false,
                  success: function(res){
                                 $('#value').replaceWith(
                                           "<div id='value'><h6>" + res + "</h6></div>"
                                           );
                                 }
                  });

what i want to do is after separate some data. the script will read data1 then do some filtering character from text value(use regex).

after match, ajax will send to DB then filtering data inside DB.
after that data will show inside page.

  • 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-18T21:06:18+00:00Added an answer on May 18, 2026 at 9:06 pm

    You are doing some strange things with your variables.

    Initially, barCode=$("#model").val(); looks reasonable, though you might want to combine it with the definition above.

    Then you call var data1 = $("#model").val(barCode.substr(0,barCode.length-8));, so data1 is actually a jQuery object: http://api.jquery.com/val/#val2

    So it looks like you are calling val(something) and expecting to get back the string, like if you’d called val(). What you probably want to do is say

    var data1 = $("#model").val(barCode.substr(0,barCode.length-8)).val();

    Because this will give you the actual value of what’s in #model.

    In addition, matches is an array, so you probably want to call

    data:"tversion="+matches.length+"&action=tunermatches", instead (note the addition of the .length to matches).

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

Sidebar

Related Questions

I am fetching some data from database and want to show these values in
Dear all, i want to show some data in one row from 1 column
I want to search some data from DataTable to show in GridView. Like (select
I am new to studying jquery.ajax. I want to paste some data from a.php
So I want to get some data from mysql and use it to create
I want to show a custom image with some data in it while clicking
I want to show some web page INSIDE Inno Setup installer page, how can
i have an alert box which i want to show some icelandic text but
I used to show a splash screen which in background load some data from
I Have activity that get some data from the internet, and shows it to

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.