Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hot to render HTML in function before calling another function?

Posted on 2011-09-06
3
Medium Priority
?
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
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:
Gurvinder Pal Singh earned 2000 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’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

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 …
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

636 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