Solved

Hot to render HTML in function before calling another function?

Posted on 2011-09-06
3
189 Views
Last Modified: 2012-06-27
Hi there,

I've got two functions that depend on each other, it's very long so this is an example of what happens.

2 functions get called during an onclick function, drawTable() and updateTable().

drawTable() basically outputs a table,

so something like this.

table id='mytable1'

then updateTable() appends to the table output so it uses the id mytable1.

$('#mytable1').append("sample");


This works perfectly in IE9 and Firefox. On Chrome there is an issue and the issue is that after the first function is ran... I think it runs the second function before it renders the html to the screen.

Does anyone know how to go about sorting this out?
0
Comment
Question by:DEGtheLEG
  • 2
3 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36487464
how does drawTable method renders the table?
0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36487465
use semicolon to seperate 2 functions. This will execute one after another.
onclick="drawTable();updateTable()"

0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36487508
if you are making any ajax calls in drawTable(), then you need to invoke updateTable() in its call back handler only
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now