简体   繁体   中英

jQuery Ajax Success Call jQuery UI

When I call the below in my code, after the element is loaded, the callback is being called but I get "Object does not support..." Any ideas why it can't find the tabs plugin even though I have jQuery and jQuery UI referenced. Another thing to note, is the filename for jQuery UI has two dots jquery-ui-1.8.5* .. *min.js and unfortunately thats not the problem, the file is truly poorly named

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="../../Scripts/jquery-ui-1.8.5..min.js"></script>
<script type="text/javascript">
    function LoadStuff() {
        $("#tabify").tabs(); //This is where it breaks
    }

    $(function () {
        $("#login").click(function () {
            $("#tabContainer").load('/Home/Login', $("#loginForm").serialize(), LoadStuff);
        });
    });
</script>

Here's the element I'm trying to load:

        <div id="tabContainer">
        </div>

Here's the element after loading:

        <div id="tabContainer">
            <div id="tabify">
                <ul>
                    <li><a href="http://localhost:51969/#stuff">Stuff</a></li>
                    <li><a href="http://localhost:51969/#morestuff">More Stuff</a></li>
                </ul>
                <div id="stuff">
                    <input id="Radio2" type="radio" name="Ace"><label for="Ace">Ace</label>
                </div>
                <div id="morestuff">
                    <input id="Radio1" type="radio" name="broden"><label for="broden">broden</label>
                </div>
            </div>
        </div>

Thanks in advance!

The problem is still probably in an inappropriately referenced jQuery UI .js file. Why does your file have 2 dots? The downloaded version is:

jquery-ui-1.8.5.custom.min.js

or:

jquery-ui-1.8.5.min.js

You can also include it directly from the google CDN, for example:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM