Solved

php explode alternative in jquery

Posted on 2009-05-20
6
3,393 Views
Last Modified: 2012-05-07
hi . i have a value in variable  like this price_33,product_1 . i want to explode like php function and store in array or two separate variables ..

simple javascript or jquery solution ?
0
Comment
Question by:hiddenpearls
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 24429611
0
 

Author Comment

by:hiddenpearls
ID: 24429738
thanks , it helped me !
0
 

Author Comment

by:hiddenpearls
ID: 24429915
hmm one problem .. still

$copy_image_product_price_id=$($id).attr("id");
                 
                              var exploded = copy_image_product_price_id.split(',');
                              var product_code=exploded[0];
                              var product_price=exploded[1];

i m getting id and then split it but it not works ..giving me error ..  
0
Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

 
LVL 42

Expert Comment

by:David S.
ID: 24439358
"$copy_image_product_price_id" and "copy_image_product_price_id" are two different variable names. Make sure they match.
0
 

Author Comment

by:hiddenpearls
ID: 24439845
@Kravimir: yes , that was the problem . u right . but what is difference between them ?
are they same variables of javascript ?
 
0
 
LVL 42

Expert Comment

by:David S.
ID: 24440383
In PHP "$" indicates the start of a variable name, but in JavaScript it's just one of the characters allowed in variable names.  "myString" and "$myString" are different variable names just like "myString", "mystring", and "my_string" are all different.

I suggest you read this: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Variables
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question