I have some id (primary keys from database) with the next format: 2019/34
. I show this code in a table where i can see it normally. The problem comes when i try to send this variable in PHP to a javascript method. As im using a slash in the id, when i send the php variable as parameter of the javascript method, it makes the count. It divides 2019 and 34 when i want to send the parameter 2019/34
.
I have tried to parse the actual php string variable to string before send it through the parameter.
I have tried to send the parameter using quotes but it makes the count too.
I have even tried to separate the id (2019 and 34), send them to the javascript method using two parameters and making again the complete string in the method. But when i use the explode method (explode("/",$id)
), it makes the count again.
echo "<td><a href='javascript:newConcepto(".$id.")'></a></td>"
Expected object sended: "2019/34".
Actual object sended: "59.3823529" (The division of 2019 and 34).