[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Hot to render HTML in function before calling another function?

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
DEGtheLEG
Asked:
DEGtheLEG
  • 2
1 Solution
 
Gurvinder Pal SinghCommented:
how does drawTable method renders the table?
0
 
Easwaran ParamasivamCommented:
use semicolon to seperate 2 functions. This will execute one after another.
onclick="drawTable();updateTable()"

0
 
Gurvinder Pal SinghCommented:
if you are making any ajax calls in drawTable(), then you need to invoke updateTable() in its call back handler only
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now