Mr.0 Mr.0 - 1 year ago 62
Ajax Question

How to load from a HTML File with style and without flickering screen with jQuery Mobile?

I want to load with this function (index.html) file the content from the templates/finden.html file with a style and without flickering.

$("#header_titel").html("Gerichte finden");

I have included jQuery and jQuery Mobile in my index.html.

<link rel="stylesheet" href="js/">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/"></script>

The problem is, that I need these commands in my templates/finden.html too. But when I do that, the page is flickering, while changing. If I don't include the commands, the flickering is gone, but I don't have the jQuery Mobile style in my page anymore.

Answer Source
$(document).on('click', '#finden', function(){ 
    $("#content").load("templates/finden.html", function() {
        $("#header_titel").html("Gerichte finden");

Works for me

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download