[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

insert html received from an ajax call into table cell

Posted on 2011-10-20
3
Medium Priority
?
300 Views
Last Modified: 2012-05-12
Greetings Experts,

I'm trying to get some html placed into a table cell that I receive from an ajax call and its not working. I know the html is correct because I put in an alert box and verified it (its a simple select box). Can someone have a look and see what I'm doing wrong?


function updateGamesDDL() {
            $.ajax({
                type: "POST",
                url: "some url",
                success: function (msg) {
                    $("#selGames").remove();
                    $("#tdGames").append(msg);    //the html for tdGames is <td id='tdGames' name='tdGames'>
                    alert(msg);
                },
                error: function (xhr, option, err) {
                    alert("XHR Status: " + xhr.statusText + ", Error - " + err);
                }
            });
        }

Open in new window

0
Comment
Question by:Big Monty
3 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37003993
you need to show more code, there nothing wrong here

http://jsfiddle.net/xz8gt/

//the html for tdGames is <td id='tdGames' name='tdGames'>

you mean :

//the html for tdGames is <td id='tdGames' name='tdGames'></td>

try to validate your html, perhaps you miss an end tag and/or the page is malformed
http://validator.w3.org/
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37004613
Another possibly is you have DOM (other html) with same id i.e tdGames by mistake in a page.
0
 
LVL 34

Author Closing Comment

by:Big Monty
ID: 37006574
had some malformed HTML, I just assumed there was something wrong with the HTML. thx!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…
Suggested Courses
Course of the Month17 days, 23 hours left to enroll

829 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