hiddenpearls
asked on
php explode alternative in jquery
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 ?
simple javascript or jquery solution ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hmm one problem .. still
$copy_image_product_price_ id=$($id). attr("id") ;
var exploded = copy_image_product_price_i d.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 ..
$copy_image_product_price_
var exploded = copy_image_product_price_i
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 ..
"$copy_image_product_price _id" and "copy_image_product_price_ id" are two different variable names. Make sure they match.
ASKER
@Kravimir: yes , that was the problem . u right . but what is difference between them ?
are they same variables of javascript ?
are they same variables of javascript ?
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
I suggest you read this: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Variables
ASKER