7
I’m passing a array
via GET
for PHP and then send it to the client side (Javascript). When I receive it it looks like this:
m_prod = [5,,,,,,,,6,,,,,,];
In other words, it is including a space in the positions that does not contain a value! How can I remove these spaces in Javascript?
<?php
$m_prod = trim($_GET['m_prod']);
print("<SCRIPT language=javascript> m_prod = \"$m_prod\"; </SCRIPT>");
?>
Just want to remove spaces? Or also reduce the array size?
– CesarMiguel
Well, at first I would like to remove the spaces, because then the array would be only with
m_prod = [5,6];
– Alexandre
Then I guess you already have the answer down
– CesarMiguel
@Alexandre can explain better where this array comes from? comes from PHP?
– Sergio
Yes the array comes from PHP!
– Alexandre
@Alexandre then the interesting is to see your PHP code to solve the problem at source. You have access to PHP?
– Sergio
@Sergio already modify the code to show how enough my php!
– Alexandre