I am using javascript for showing a link in php Codeigniter. But I want
toredirect to a new php page with new tab when click the link . my
controller is loginController and my function is downloadPdf().
how to do this.
my java script is
contentRow += '<div>click here</div>';
and this javascript code will append to div in php code
my need is when i click this link ,i have to pass a parameter to the redirecting page for some process.but with codeignitor
use the HTML a target='_blank' attribute to link.
Related
i am working on a login form and i basically want the user to be able to get redirected on the singup form when he clicks to a link. Any help?
Create an anchor with an href attribute with a link to your signup page as follows
sign up
Can be done simply with HTML href tag like:
Sign Up
If you want to add via php:
echo 'Sign Up';
Read More about href
I have a iFrame inside an php page.
The iFrame contains form (in asp), can I link a button outside the iFrame to the button outside?
Thanks!
you can use a button on main page to click a button on iframe page using jquery.
for example in main page if you have:
Main page HTML Sample:
<button id="parentbutton">click me</button>
<iframe name='select_frame' src='http://www.barzegari.com/DEAFULT.ASP'></iframe>
JQUERY in main page:
$("#parentbutton").click(function(){
$('input:button[name=save]').click(function() {
$('iframe[name=select_frame]').contents().find('#mybuttonid').click();
});
});
in iframe html:
you have a button with id(clientid) like "mybuttonid";
this is prevent by cross domain privacy, but you can do it by this way,
in your php page, use file_get_contents to get asp content, filter get form script and paste to php page, by this way, you can do everything as you want :)
Accessing iframe content from other URL will give you the error Refused to display 'YOUR_URL' in a frame because it set 'X-Frame-Options' to 'sameorigin'. This is because, all the server restricts the access of iframe content from third party website for security purpose. If you are not getting the above error, try the below code in your PHP file.
$("#phpbutton").click(function(){
var iframe = $('#aspiframe').contents();
iframe.find("#aspbutton").click();
});
<iframe id='aspiframe' src='YOUR_ASP_URL'></iframe>
<input type="button" id="phpbutton">click here</button>
Note : Make sure you have replaced with correct IDs.
I am working in cakephp application.
Here all the calls happening with Ajax. So user wants to keep one button or link, when user click on the link it will show one with contains help info of that page. I'm able load div with right content. But dynamically I'm not able to display one link (Show Help) on the page dynamically.
The reason for the "Show Help" link dynamic is based on which page loads I have to pass value to JavaScript function.
Plz help me how to add this link in $content_for_layout so that it will display dynamically in all the pages.
Step1: This is the code to create helper. Put the following code in app/views/helpers/LinkHelper.php
class LinkHelper extends AppHelper {
var $helpers = array('Html');
function showHelp() {
$url = '';//create your url dynamically here
$title = 'Show Help';
return $this->Html->link($title, $url, array('class' => 'help'));
}
}
Step2: Load the Link Helper in layout
$HelpLink = $this->Helpers->load('Link');
Step3: Call showHelp method of LinkHelper where Show Help link to be shown.
echo $HelpLink->showHelp();
As per my client need , redirect the page without anchor tag and refresh page ,
and change the URL as per page appearance. I don't know any idea about this.
I can use ajax for page content. but I don't know the URL change option without
page refresh or redirect. how can I do this with ajax j-query. Any one guide me for this issue.thanks advance
sample url
www.samplesite.com/contact.php -> without anchor tag. and page refresh this url need to work on php.
I think you are looking for info about the new HTML5 History API ( pushstate ), this link has a detailed tutorial.
http://diveintohtml5.info/history.html
You can do this using below function.
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
You can use the following javascript functions
window.location.assign('http://www.samplesite.com/contact.php'); // keeps the current page in browser history
window.location.replace('http://www.samplesite.com/contact.php'); // replaces the current page in browser history
window.location = 'http://www.samplesite.com/contact.php'; // the same as assign() and is backward compatible even with the oldest browsers
jsfiddle
I have the following code in my web app
<li>A</li>
And the javascript function 'next' creates and loads the following link when the above item is clicked:
.../testing.php?first=A#result
It works fine, It calls the 'result' anchor, and I extract the value of 'first' via:
$first=$_GET['first'];
but the problem is, I am using JQuery Mobile and the sliding effect that usually happens between anchor switches doesnt work. It simply loads another page.
I tested out a bunch of different ways of passing the data through the URL, and it seems the slidin g effect only happens when the anchor tag immediately follows the 'testing.php' portion of the url like this:
.../testing.php#result
Is there a way to pass the data in a URL after the anchor tag and extract it with php?
OR
Is there a way to force the sliding effect?
Thanks guys.
If you are loading the new page into the dom via jQM's ajax-handling of links then you can omit the hash portion of the url. When jQM loads the new page into the dom it only load the portion of the page within the data-role="page" element. So if you use a url like:
/testing.php?first=A
and testing.php outputs a page like this:
<div data-role="page" id="testing_<?php echo $_GET['first']; ?>">
...
</div>
then the rest of the website can use the id (testing_A) output by testing.php to reference the newly added page.