Browser doesn't renders table element | jsFiddle example

Browser doesn't renders table element | jsFiddle example



My code makes a cross domain request to fetch the source of a webpage, using James Padolsey's "cross domain mod for jQuery": https://github.com/padolsey/jQuery-Plugins/tree/master/cross-domain-ajax;



Then it selects the first table and appends it to a existing div.



But the appended table doesn't get rendered properly. Can anyone take a look at this fiddle and tell me why?



http://jsfiddle.net/6ZgRf/






Side note, don't use a global variable to communicate the response from one function to another. Pass it as an argument: stripViewResponse(res.responseText); and receive it as a parameter function stripViewResponse(antwort) {...
– I Hate Lazy
Oct 5 '12 at 17:57


stripViewResponse(res.responseText);


function stripViewResponse(antwort) {...





I know that. But your are right, others maybe won't. So thanks for the hint. Here is the updated jsFiddle: jsfiddle.net/zjy73
– John
Oct 5 '12 at 18:42





2 Answers
2



You're using jQuery.. so you can traverse it by turning it into a jQuery object


function stripViewResponse()
// Select table element
var fetchedTable = $(antwort).find('table')[0]; // find first table
// append table
$('#new').append(fetchedTable);



http://jsfiddle.net/6ZgRf/1/





Awesome! As you can see I'm just getting started. Thank you very much.
– John
Oct 5 '12 at 17:48



You can also try this


function stripViewResponse()
// Select table element
var fetchedTable = $(antwort).find('table').eq(0);
// append table
$('#new').append(fetchedTable);





Thanks! It's almost the same as @wirey suggested.
– John
Oct 5 '12 at 18:14



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)