lundi 11 septembre 2017

passing javascript variable to php in cakephp 2 view

I am trying to pass a javascript variable into a php code in the view file of the cakephp 2.

 for (id in response) {


                               var book = response[id];

                                    if (typeof(book.thumbnail_url) != "undefined") {
                                    var x= book.thumbnail_url; 


                                  <?php   $file11 = WWW_ROOT . 'img' . DS . 'book_images';
                                         define('DIRECTORY', $file11);

                                    $content = file_get_contents($abc);
                                    file_put_contents(DIRECTORY . '/'.$isbn.'.jpg', $content);?>
                                  }



                                 }

i am trying to pass the value of x in the 'file_get_contents' function in place of $abc so that it could save the image coming from the javascript's URL accordingly.




Aucun commentaire:

Enregistrer un commentaire