Open/Close with fb.ajax

Page: 1

Author Post
Member
Registered: Oct 2012
Posts: 19
I use fb.ajax to display content on my page, something like this :

<div>
<button type="button" onclick="fb.ajax({ source:'abcd.php', updateNode:'ajaxDiv' });">Open</button>
<div id="ajaxDiv"></div>
</div>

When I click on 'Open' button, abcd.php content is displayed. Works fine.

What I now want to do, when content is displayed :
- Change the button name to Close
- 'erase' (= not display) the abcd.php content when I click again on the 'Close' button.

How can I do this ? Without jQuery...
Administrator
Registered: Aug 2008
Posts: 3382
As mentioned in our email conversation on this same topic, you are asking about building page content, not about Floatbox usage. I'm not here to provide free web-site authoring assistance. I just do Floatbox support.

What you're asking about is manipulating your page's DOM and associated styles by javascript in response to some action. So you need to write the manipulation code that you want, whether using jQuery or not, and trigger that code when the action occurs. It sounds like in your case the triggers could be a "success" callback to the ajax call and an onclick action assigned to your button.

(Oops, I just violated my policy of not helping to author pages. ;) )

Page: 1