Solved

Hot to render HTML in function before calling another function?

Posted on 2011-09-06
3
191 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

776 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