I have public static function with parameter in my controller. I need to use this function inside javascript which is in for loop. How can I use JS for loop variable inside php vairble as array count?
Here is example of code:
var passedArray = {!! json_encode($elanlar)!!};
var passedArrayRegion = {!! json_encode($region)!!};
for (var i = 0; i < my_count; i++) {
console.log('lat: '+passedArray[i]['Coordinatex']+ ' lng: '+passedArray[i]['Coordinatey'] )
Ldata.info.push({
"placeName" : passedArray[i]['Column1']+ ' '++' '+ passedArrayRegion[passedArray[i]['Column3']]['Column4']
});
}
i here is JS variable
I have tried so much variants and read so much in forum, but couldn`t fin an answer. How to use js variable i in this condition?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BbvwUK
via IFTTT
Aucun commentaire:
Enregistrer un commentaire