[jQT] Jumping to a specific div using AJAX

35 views
Skip to first unread message

Gonzalo Floria

unread,
Apr 23, 2010, 8:35:17 AM4/23/10
to jqt...@googlegroups.com
Hi

Im having a very stupid problem.
I have a main page that loads some children via AJAX. That part was working fine.
Now I want to load a page with 2 divs. I want to show "firstDiv". This div has a link that will show/load secondDiv.

I saw in the examples that something like this is done in the Ajax part: "load('ajax.html .info'..."

I tried the same but Im failing...
All I get is a blank screen, with no toolbar or body :(
This is the structure of my pages:

1) The TARGET page:
<div id="firstDiv">
    <div class="toolbar">
    <h1>First div</h1>
    <a class="back" href="#">Back</a>
    </div>
    <div class="firstDivBody">
        First div body here
        <ul class="rounded">
            <li class="arrow"><a href="#secondDiv">Jump to 2nd div</a></li>
        </ul>   
    </div>
</div>

<div id="secondDiv">
    Second div body goes here
</div>


2) The MAIN page:
        <div id="sales" class="current">
            <div class="toolbar">
                <h1>Master page</h1>
                <a class="back" href="#">Back</a>
            </div>
            <ul class="rounded">
                <li class="arrow"><a href="#moveOn" onclick="loadNewDiv('newDiv','SecondPage.jsp .firstDiv')">Second page first div</a></li>
            </ul>
        </div>

3) My loading method: I created it to automatically have a "loading" screen on all AJAX links

function loadNewDiv(newDivId, targetURL){
            $("body").append('<div id="'+newDivId+'">\
                                <div class="toolbar">\
                                    <h1>Loading</h1>\
                                    <a class="back" href="#">Back</a>\
                                </div>\
                                <div style="text-align:center; font-size: 17px; margin-top: 16px; font-weight: bold;">Loading...</div></div>');
    //fetch data
    $('#'+newDivId).load(targetURL);

    // Replace loading screen with report we just loaded
    jQT.goTo('#'+newDivId, 'slide');
}



please please please, a hand????

thanks in advance.
Gonso

--
-----------------------------------
Gonzalo Floría Giráldez

Gonso

unread,
Apr 27, 2010, 2:27:10 PM4/27/10
to jQTouch
anyone??? pretty please?
> --
> Subscription settings:http://groups.google.com/group/jqtouch/subscribe?hl=en

B

unread,
Apr 27, 2010, 5:15:09 PM4/27/10
to jQTouch
try

$("body").append('<div id="'+newDivId+'" class="current"'>\

I normally let jqtouch handle the ajax call
Reply all
Reply to author
Forward
0 new messages