无法从jquery中的外部文件调用特定内容 [英] Unable to call specific content from an external file inside jquery

查看:48
本文介绍了无法从jquery中的外部文件调用特定内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用DIV容器内的jquery加载位于外部html文件内部的特定内容:/

I am unable to load a specific content located inside of an external html file using jquery inside DIV container :/

请访问链接: http://www.flyingcowproduction.com/123 以获得更好的按下主菜单中的任何按钮都会遇到问题.每个按钮都应显示分配给它的内容,但是load.php文件中的全部内容将显示在容器中

Please visit a link: http://www.flyingcowproduction.com/123 to have a better idea of a problem I am experiencing by pressing any button of the main menu. Each button should show a content assigned to it but instead the entire content inside the load.php file is displayed inside the container

有人知道问题出在哪里吗?我还提供了菜单代码,javascript和指向加载程序页面的链接(查看源代码).

Does anyone know what the problem is? I am also providing the code for the menu, javascript and the link to the loader page (view source).

菜单:

<ul id="menu">

        <li><a href="home" class="openContentLink"><img src="img/menu/logo.png" alt="Platinum Limo Services" /></a>
        <li><a id="services1" href="#Services" class="services openContentLink"></a></li>
        <li><a id="rates1" href="#Rates" class="rates openContentLink"></a></li>
        <li><a id="reservations1" href="#Reservations" class="reservations openContentLink"></a></li>
        <li><a id="fleet1" href="#Fleet" class="fleet openContentLink"></a></li>

</ul>

JAVASCRIPT:

JAVASCRIPT:

function loadPostUsingAjax(section) {
loading('on');

var loadStr = "load.php" + section;


$('#singleContentInside').load(loadStr, function(){

    loading('off');

    $("#services1").click(function() {
        loadPostUsingAjax("#services")
    });
    $("#services2").click(function() {
        loadPostUsingAjax("#services")
    });
    $("#rates1").click(function() {
        loadPostUsingAjax("#rates")
    });
    $("#rates2").click(function() {
        loadPostUsingAjax("#rates")
    });
    $("#reservations1").click(function() {
        loadPostUsingAjax("#reservations")
    });
    $("#reservations2").click(function() {
        loadPostUsingAjax("#reservations")
    });
    $("#fleet1").click(function() {
        loadPostUsingAjax("#fleets")        
    });
    $("#fleet2").click(function() {
        loadPostUsingAjax("#fleets")        
    });

});

}

LOADER:

http://www.flyingcowproduction.com/123/load.php

预先感谢十亿!

推荐答案

您可以链接到同一页面的某个地方,如此处所述:

You can link to somewhere at same page as like described here: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_link_locations

因此,如果您遇到一些问题,可以尝试这种方式.在同一页面上给予链接并调用该链接,即可单击该链接或将其单击选项卡单击功能关联以将其触发.

so if you have some problems you can try that way. Give to link at same page and call that click or relate your tab click functions to fire it.

这篇关于无法从jquery中的外部文件调用特定内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆