I'm new to JS & Ajax. Need urgent help with following code.
I'm not able to pass Javascript variable into PHP variable. Any help would be much appreciated.
I've a single file with name a.php which contains entire code (JS+PHP+HTML) and I dont want to use Submit button. Whenever openLightBox() function is called, it should return value to the form called in HTML.
Thanks in advance!!Code:<html> <head> <script language="JavaScript" type="text/javascript"> function openLightBox(imgsrc){ var id1 = imgsrc; $.ajax({ type: "POST", url: "a.php", data: "id1"+id1 }); } </head> <body> . . . . <form action="#" method="POST" enctype="multipart/form-data"> <input type="hidden" id="id1" name="id1" /> <?php echo "Hello"; echo $_POST['id1']; ?> </body> </html>



Reply With Quote
Bookmarks