Computing.Net > Forums > Web Development > load csv file into a javascript file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

load csv file into a javascript file

Reply to Message Icon

Name: jamesfleeger
Date: May 15, 2009 at 12:59:29 Pacific
OS: Windows XP
Subcategory: HTML
Comment:

Is this possible ? I am wanting to pull out a price of a product from the csv file and tie that price to its particular part number.

I am doing this for a website and I am learning script programming at the same time, and I am unsure how to do this.

The JS file would call the csv file and pull the price and part number out of it.

From there the JS file will create a form to use with a Paypal shopping cart.

This is the paypal shopping cart code for the add to cart button:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="XXXXX">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="PartNumber1">
<input type="hidden" name="amount" >
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="weight" value=".5">
<input type="hidden" name="weight_unit" value="lbs">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

</form>

Using the variable I added to this button, the JS file would look similar to this:

function CalculateOrder(form)
{

if (form.item_name.value == "PartNumber1"
{
form.amount.value = (The price variable would go here);
}

if (form.item_name.value == "PartNumber2"
{
form.amount.value = (The price variable would go here);
}
}

What I need before this code in the JS file is the code that loads the csv file and outputs the price and part number. The JS file would search for the part number labelled called "PartNumber1" and output the appropriate price from the csv file.

HELP PLEASE !!



Sponsored Link
Ads by Google

Response Number 1
Name: cyoung311
Date: May 18, 2009 at 10:00:57 Pacific
Reply:

See reply to "Importing .CSV"


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: load csv file into a javascript file

AJAX Problem: Loading Page into Div www.computing.net/answers/webdevel/ajax-problem-loading-page-into-div/3398.html

Read data from a table in pdf file www.computing.net/answers/webdevel/read-data-from-a-table-in-pdf-file-/3124.html

Help with IP Banning www.computing.net/answers/webdevel/help-with-ip-banning/134.html