php explode alternative in jquery

Posted on 2009-05-20
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 ?
Question by:hiddenpearls
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
LVL 42

Accepted Solution

David S. earned 500 total points
ID: 24429611

Author Comment

ID: 24429738
thanks , it helped me !

Author Comment

ID: 24429915
hmm one problem .. still

                              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 me error ..  
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

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.

Author Comment

ID: 24439845
@Kravimir: yes , that was the problem . u right . but what is difference between them ?
are they same variables of javascript ?
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:

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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