Glenskie Posted March 26, 2014 Share Posted March 26, 2014 Okay so i have a file that i need some php variables from. This is the code that i am using. please help ! This is the ajax that i am trying to use to get the variable and then set it to a php variable. $.ajax({ url : 'pagination_data.php?page=1', type : 'POST', data : data, dataType : 'json', success : function (result) { var k=result; <?php $next ?>=var k; }, error : function () { alert("error"); } }); Now here i am setting the varialbes in the other file. $next = $page+1; $prev = $page-1; echo json_encode($next); echo json_encode($prev); and this is where i need the variables... <?php echo "<div class='controls' id='$prev'></div><div class='controls' id='$next'>"; ?> Link to comment https://forums.phpfreaks.com/topic/287304-how-to-pass-php-variable-from-one-file-to-another-with-jquery/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.