Pavlos1316 Posted November 18, 2014 Share Posted November 18, 2014 I am using this to open contents into a modal window, but in the process I am passing it through loop.php to check if the page exists and then load. Is there a way to completely skip the loop.php file and load my clicked link? $(document).ready(function(){ ///////LINK in a Modal Window//////// $('#all').delegate('a.pop-lnk', 'click', function(){ var page = $(this).attr('id'); $('#gr-out').css({ opacity: 0.7, 'width':$(document).width(),'height':$(document).height()}).show(); $('#popup').css({'display': 'block'}); $('#popup').load("../help-file/loop.php?page="+ page); }); }); The id attr I am getting from this code is my page's name but I need to add the .php extension if is possible so I can load the page. Link to comment https://forums.phpfreaks.com/topic/292552-can-i-add-php-to-a-file-using-jquery/ Share on other sites More sharing options...
requinix Posted November 18, 2014 Share Posted November 18, 2014 Is page a proper URL? Can you actually skip loop.php, like are the things it does not terribly important? Then sure: don't use loop.php and .load() the page directly. Link to comment https://forums.phpfreaks.com/topic/292552-can-i-add-php-to-a-file-using-jquery/#findComment-1496941 Share on other sites More sharing options...
Pavlos1316 Posted November 18, 2014 Author Share Posted November 18, 2014 Is page a proper URL? Can you actually skip loop.php, like are the things it does not terribly important? Then sure: don't use loop.php and .load() the page directly. loop.php does nothing important. just checking if page exists but that is carried out by the server. I have eg 2 links: <a id="test1" class="pop-lnk"> <a id="test2" class="pop-lnk"> By clicking the link I use my JQ code to open the information of test1.php in a modal window. But the loop.php takes the IDvalue from my <a> and adds the .php extension so JQ can load the file. Can JQ add the .php extension so I skip loop.php? Link to comment https://forums.phpfreaks.com/topic/292552-can-i-add-php-to-a-file-using-jquery/#findComment-1496942 Share on other sites More sharing options...
requinix Posted November 18, 2014 Share Posted November 18, 2014 Sure. Javascript is a programming language. It can do things like add two strings together. $('#popup').load("../help-file/"+ page + ".php"); // I'm guessing at the path Link to comment https://forums.phpfreaks.com/topic/292552-can-i-add-php-to-a-file-using-jquery/#findComment-1496944 Share on other sites More sharing options...
Pavlos1316 Posted November 18, 2014 Author Share Posted November 18, 2014 Sure. Javascript is a programming language. It can do things like add two strings together. $('#popup').load("../help-file/"+ page + ".php"); // I'm guessing at the path I am stupid I was trying your answer the last hour... Forgot to add the full path ../help-file/ that's why it wasn't working Now that I saw it written by you I realized!!! Thank you by the way... I will mark it as best answer. Link to comment https://forums.phpfreaks.com/topic/292552-can-i-add-php-to-a-file-using-jquery/#findComment-1496949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.