This topic contains 5 replies, has 2 voices, and was last updated by Sean Sean 2 years, 1 month ago.

Ajax sample and GlobalImgPath()


  • renee
    Participant

    Posts: 25
    Member Reply #7511

    Hi.

    i have two problems,

    first: where i can set and change the GlobalImgPath() attribute, because if i user your template in a subfolder some images will not display correctly.

    second: i try to add a ajax content (http://keenthemes.com/preview/metronic/theme/admin_2/layout_ajax_page.html) but i dont understand how it will works, could you please tell me more or make me a simple “ajay content” sample file?

    I thank you a lot.

    Renee

    Sean
    Sean
    Keymaster

    Posts: 4527
    Support Staff Reply #7518

    Hi,

    To change the assets path you can use below code in the bottom of your HTML:

    jQuery(document).ready(function() {

    App.setAssetsPath(‘set your assets path here’); // init metronic core componets

    });

    The sample for the ajax content setup was provided in the theme.  If you explain your issue we will try to help you out. You can refer to the source code and the brief documentation in the ajax demo page on how to setup ajax content properly.

    Thanks.

    
    
    		
    	

    renee
    Participant

    Posts: 25
    Member Reply #7528

    Hi.

    about the globalpath, i add the folowing code an the end of the file (at least after including all .js files)

    <script>// <![CDATA[
    jQuery(document).ready(function($) {
    App.setAssetsPath('../../../assets/'); // init metronic core componets
    alert('../../..//assets/');
    });
    
    // ]]></script>

    For me it wont work, also the alert wont display, is there a wrong code inside or do i something else wrong?

    • This reply was modified 2 years, 1 month ago by  renee.
    • This reply was modified 2 years, 1 month ago by  renee.
    Sean
    Sean
    Keymaster

    Posts: 4527
    Support Staff Reply #7543

    Hi,

    Can you please provide a test link to your developing site or at least provide some screenshots from your browser console log ?

    Thanks.


    renee
    Participant

    Posts: 25
    Member Reply #7563

    Hi, of course, here is the link to the site where i try to add a ajax content and also where i try to change the globalpath

    http://wp1076647.server-he.de/module/1/code/kontakte.php

    Here i try to include the “ajax.js” file. This file is linking to “ajax.php” and in this file is only the following content for beginning

    $records='HALLO';
    echo json_encode($records);

    • This reply was modified 2 years, 1 month ago by  renee.
    Sean
    Sean
    Keymaster

    Posts: 4527
    Support Staff Reply #7573

    Hi,

    You should go to datatables.net and learn how to use this plugin. You have some js errors with $(‘#sample_1’).DataTable( {…}) code so the rest of the JS codes are not being fully executed.

    By right you should initialize any JS code within jquery ready event handler:

    jQuery(document).ready(function() {
    // call  js code here
    });

    Also you should manually change the image assets paths in HTML code(e.g: the logo image ../assets/layouts/layout2/img/logo-default.png) since the JS function can change the image path only in the JS level not in the HTML level.

    If you need any further clarifications please please let us know.

    Thanks.

Tagged: 

You must be logged in to reply to this topic.