Solved

php explode alternative in jquery

Posted on 2009-05-20
6
3,400 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
Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

636 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