Solved

php explode alternative in jquery

Posted on 2009-05-20
6
3,380 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
  • 3
  • 3
6 Comments
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
Comment Utility
0
 

Author Comment

by:hiddenpearls
Comment Utility
thanks , it helped me !
0
 

Author Comment

by:hiddenpearls
Comment Utility
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
Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 42

Expert Comment

by:David S.
Comment Utility
"$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
Comment Utility
@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.
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now