<script type="text/javascript" >
var arrayjs = <?php $arrayphp = array(1,3,5,6,7,10); ?>
//each? for? with jQuery {
console.log(num);
}
</script>
I have array in PHP. How can i get this for jQuery and showing with loop each or for?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no
foreachin JavaScript. You have to do it old-school with indexes.To pass a PHP variable to JS, use
json_encode.Edit: You can use $.each if you’re using jQuery.