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();"  />

Comments

  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

Post a Comment

If you Satisfied , Please Leave a comment

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress