Thursday, July 5, 2012

php string to javascript array




<?php  $str="RAJEEV~@~DHAR~@~DWIVEDI";   ?>
<script>
function getarray(x){
var str="<?php echo $str ; ?> ";
var arr=str.split('~@~');

alert(arr[0]); alert(arr[1]); alert(arr[2]);
}
</script>
<input type="button" value="getarray" name="GET ARRAY" onclick="getarray();"  />

1 comment:

  1. It is actually a nice and helpful piece of information.
    I'm satisfied that you simply shared this helpful information with us.
    Please keep us up to date like this. Thank you for sharing.



    Visit my homepage - SW Florida Web Design

    ReplyDelete

If you Satisfied , Please Leave a comment