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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:47:37+00:00 2026-05-27T21:47:37+00:00

Previously I asked about how I could call separate values from a text file

  • 0

Previously I asked about how I could call separate values from a text file without using php ( Include .txt content WITHOUT server side lang? ), and with some of your help I solved the problem:

<script type="text/javascript">
jQuery.get('db.txt', function(data) {
    $('#db').html(data);
     var element = $("#db").text().split("|"); 
     $('#1').text(element[1]);
     $('#3').text(element[3]);
   });
  </script>

  <span id="db" style="display:none;"></span>

  <span id="1"></span>
  <span id="3"></span>

If my text file looks like this Name1 | Number1 | Name2 | Number2 | it will display:

Number 1 Number 2

Works great, except I have ONE little problem left.

Before, when I used php, I had an OnClick function that looked like this:

onClick="simpleCart.add('name=Productname', 'price=<?php echo ''.$field[$loop][1].''; ?>','quantity=1');

The price was echoed from the database with php, but now I can’t use any server side language any more. <span id="1"></span> gets the same value as <?php echo ''.$field[$loop][1].''; ?> does, I just don’t know how to write it in the OnClick function? I need the span value to be equal the price.

Hope you can help me out here!

  • 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-27T21:47:38+00:00Added an answer on May 27, 2026 at 9:47 pm
    $('span#1').click(function() {
         /* your code like
         simpleCart.add('name=Productname', 'price=' + $('span#1').text(),'quantity=1');
        */
    });
    

    or

    $('span#1').bind('click', function() {
        /* your code like
         simpleCart.add('name=Productname', 'price=' + $('span#1').text(),'quantity=1');
        */
    });
    

    check jQuery API: http://api.jquery.com/click/

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

Sidebar

Related Questions

I previously asked about what Mixins were, and have begun to get the gist
Previously I've asked about inserting a column into a dataset . I now have
I previously asked a question about chaining conditions in Linq To Entities. Now I
Previously, I asked about a clever way to execute a method on a given
I asked a similar question about this previously, but I did not specify that
This stems from a previous question I asked - about a write conflict with
Previously I asked this question: Read quicktime movie from servlet in a webpage? Basically
I previously asked a question on stack overflow about how to format my date
I asked a question about this previously but my database structure has changed, and
This question is about the same program I previously asked about . To recap,

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.