Quote your string while passing to function article()
$ids="304620,306408";
echo '<script>article("'.$ids.'");</script>';
Question
My function transforms the parameter string to int.
I've a string variable in PHP, in php I call a test(variable) function, which is a jQuery function (in other file). When I show the variable in the function, get an int variable. Example:
File .php
$ids="304620,306408";
echo '<script>article('.$ids.');</script>';
File jQuery
function article(ids){
alert(ids); *//show 304620 only*
alert(jQuery.type(ids)); *//show number*
}
Any idea?
Solution
Quote your string while passing to function article()
$ids="304620,306408";
echo '<script>article("'.$ids.'");</script>';
OTHER TIPS
If you want to show 2 values in your jQuery function,Try passing an array from php into the jQuery function.
Secondly,By Default jQuery is changing the php's string value into a number datatype, So you could simply type cast your jQuery number variable into a string.