goes back to home page when refreshing jquery - php

I have a website with functionality of jquery for navigation. I use the load() function of jquery that enables the website to be navigated without refresh. But when I hit f5 for refresh for example I am in the Contact Us page it will hit back on the index page which is the parent page. Is there a way in jquery or ajax to focus on the page loaded when hitting refresh rather than redirecting it to the index.php page?

The best way is to use some form of history navigation. pjax is a great plugin that allows you to use both real URLs and ajax loading functionality.
You could also implement it by simply changing window.location.hash when you load new content. Then when the page is loaded, you could check window.location.hash and load the relevant content.

Related

How to redirect the entire page from a dynamically loaded ajax file

I have a page which is pretty basic. There is a jquery script that runs when a user clicks on a menu item. The jquery runs a ajax to load the content of ANOTHER page inside a div tag. The page that loads checks to make sure the user is logged in still. The problem is i can not redirect the entire page back to the login screen.
META HTML REDIRECT
i have tried this. The issue here, not all the browsers redirect - such as FF. And I really don't like this way.
HEADER REDIRECT
I have tried to insert a header redirect in the page that loads. The issues here is, the ajax inserts the login page inside the div tag... resulting in a website inside of a website.
Is there any other way of doing this? Thank you.
You could use JavaScript to redirect. Try window.location.replace(your_login_url) which is similar to a HTTP redirect.

Php use header location to load new page in entire window within jquery tabs

I use Jquery tabs with in each tab a form. If the form is submitted it’s reloaded (after the actions in the database) in the tab so that not the whole page has to be reloaded. One of the forms has to link to a payment page if there has to be payed, so after some checks after a submit the payment page has to be loaded and the current page has to close. But if I use header-location the entire page Is loaded in the tab and i don’t want that….
Ho to use header-location from within the tab and load the payment page in the entire window (from PHP and not from Javascript because I can’t do the checks and vallidations)….
Use iframes or check out the jQuery $.ajax() method
You can use
echo "<script>
window.location='?action=';
</script>";

jquery mobile - force page update on ajax pull

My app currently changes data quite frequently and requires the user to switch back and forth between pages.
I often find that when a page is loaded through AJAX, and then you return to said page either through the backbutton, or by clicking a link...the information isn't always refreshed.
Is there a way to force this refresh?
This is due to the fact that when you link pages through AJAX navigation in Jquery mobile they are automatically loaded into the DOM according to the documentation.
Try adding a data-dom-cache="false" to your "page" as one of the attributes.

Login to ajax loading of home page

I am trying to create a dynamic login screen where my whole 'logged in' page isnt loaded into the dom until the form validates where the login screen scrolls down into the homepage without 'actually' scrolling.
I was thinking of doing this by
form -> ajax -> validate -> on validate ajax load expanding div under login area and load home page with ajax -> jquery hide login area.
Is there any easier way? if I already have both pages combined currently to just hide that part of the dom?
In general, I'd propose to give XAJAX a try.
The XAJAX library integrates well with PHP and e.g. allows to update several DOM elements at once.
In general, I'd prefer to run the login-operation in a non-AJAX fashion. But that's more or less a matter of taste. Once the user is logged in, I'd switch to AJAX.
Moreover, I wouldn't just hide the logged-in DOM element.
May be this could help you: Login y logout con PHP, MySQL, JQuery y Ajax (Spanish) http://bit.ly/tBmHtV
It have worked for me.

button control php page include

because of considering embed google ads into include page. I am giving up jquery.loading
(google not allow jquery ajax and jquery loading for ads, now even iframe page)
so is it possible use other javascript method for control php page include?
more explain, if my page need to including 10 pages, and I do not want they all loading in same time(such slowly for loading at same time). So I put 10 buttons for switching include page.
only click each button, loading the chosen include page to main. and click another one, loading the new one and hidden the first one.
As long as they are links google should crawl them fine, you just need to stop the link from being clicked on in javascript...
Test Page
Then your jquery...
$(document).ready(function(){
$('a.test').click(function(e){
// Load the AJAX here
// Stop the click from actually going to the page
e.preventDefault();
});
});

Categories