Ajax content loading issues

user3027531

Following is my code which I am using to load contents dynamically. The issues which I am facing are the following:

Following code has now disabled CTRL+CLICK shortcode to open a url in a new tab. The new CSS and JS are not applying if they are not already exist in the previous page. Kindly let me know how can I resolve above mentioned issues?

 $(document.body).on("click", "nav a", function () {
      topen = $(this).attr("href");
      window.location.hash = $(this).attr("href");
      $("#main_wrapper").load( topen +" #main_wrapper > *");
      return false;
 });
HJ05

What you want to do is modify the handler to use prevent default instead of returning false. Then you can check how the user activated the button and can act accordingly.

$(document).ready(function() {
    $('a').on('click', function(e) {
        if(e.ctrlKey || e.button === 1) {
            return;
        }
        e.preventDefault();
        // Do the stuff when the anchor is just clicked.
    });
});

You can examine the Fiddle

In terms of the JS and CSS not applying we would need a working example of this to be of more assistance.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

wordpress loading page content via ajax

分類Dev

Loading AJAX content inside jQuery tooltip while hovering

分類Dev

Dash issues with loading static and dynamic graphs in combination

分類Dev

Android WebView not loading Mixed Content

分類Dev

Partialviewresult rending issues using ajax

分類Dev

AJAX loading in HTML to a div not working

分類Dev

loading content into a div from data within a href

分類Dev

Jquery Content Carousel not loading items properly

分類Dev

Issues with multiple AJAX calls requesting JSONP

分類Dev

How to resize image before loading to ImageView to avoid OOM issues

分類Dev

Spark on K8's Issues loading jar

分類Dev

Ajax: Posting dynamic ajaxed content

分類Dev

Interpret javascript code after loading AJAX

分類Dev

Yii: Javascript & CSS not loading after Ajax calls

分類Dev

why this code is not loading pages ajax jquery

分類Dev

Audio wont play after loading contents with AJAX

分類Dev

Angular2 loading dynamic content/html in for loop

分類Dev

Blogger API Retrieve specific post issue loading content in WebView

分類Dev

Loading different content to modal box with one JavaScript file

分類Dev

How to prevent images from shifting content when loading?

分類Dev

DataGridView freezes when loading content and style C#

分類Dev

WordPress AJAX load posts content in popup div

分類Dev

AJAX appended content does not execute Javascript

分類Dev

Use Ajax to populate the content of popover of Twiterbootstrap

分類Dev

Reinitialising content script after Ajax load?

分類Dev

Website loading issues iOS on iPad2, iPhone 4S

分類Dev

Loading more eloquent hasMany relation queries through ajax in Laravel?

分類Dev

Handle session timeout when loading data through ajax with jquery DataTables

分類Dev

JQuery AJAX Submit Button loading indefinitely when using database

Related 関連記事

  1. 1

    wordpress loading page content via ajax

  2. 2

    Loading AJAX content inside jQuery tooltip while hovering

  3. 3

    Dash issues with loading static and dynamic graphs in combination

  4. 4

    Android WebView not loading Mixed Content

  5. 5

    Partialviewresult rending issues using ajax

  6. 6

    AJAX loading in HTML to a div not working

  7. 7

    loading content into a div from data within a href

  8. 8

    Jquery Content Carousel not loading items properly

  9. 9

    Issues with multiple AJAX calls requesting JSONP

  10. 10

    How to resize image before loading to ImageView to avoid OOM issues

  11. 11

    Spark on K8's Issues loading jar

  12. 12

    Ajax: Posting dynamic ajaxed content

  13. 13

    Interpret javascript code after loading AJAX

  14. 14

    Yii: Javascript & CSS not loading after Ajax calls

  15. 15

    why this code is not loading pages ajax jquery

  16. 16

    Audio wont play after loading contents with AJAX

  17. 17

    Angular2 loading dynamic content/html in for loop

  18. 18

    Blogger API Retrieve specific post issue loading content in WebView

  19. 19

    Loading different content to modal box with one JavaScript file

  20. 20

    How to prevent images from shifting content when loading?

  21. 21

    DataGridView freezes when loading content and style C#

  22. 22

    WordPress AJAX load posts content in popup div

  23. 23

    AJAX appended content does not execute Javascript

  24. 24

    Use Ajax to populate the content of popover of Twiterbootstrap

  25. 25

    Reinitialising content script after Ajax load?

  26. 26

    Website loading issues iOS on iPad2, iPhone 4S

  27. 27

    Loading more eloquent hasMany relation queries through ajax in Laravel?

  28. 28

    Handle session timeout when loading data through ajax with jquery DataTables

  29. 29

    JQuery AJAX Submit Button loading indefinitely when using database

ホットタグ

アーカイブ