ajax and creating elements

alexho

New Member
Reaction score
0
hhello,
how can i accomplish this:
I am using ajax communicating with my server with the output code i wish to \ use it to create an element div or even just text and stick it into a parent element as 'data' but i want the data to be as text/html from its output. the only node i can find for appending anything text to an element is createTextNode, but this strips out html which i cant seem to find a work around, how can i create a new element dynamically with html/text data? would this just mean i wouykd have to process every html element from the raw text node??


var txt = document.createTextNode(a);
document.getElementById('parentdiv').appendChild(txt);
var p=document.createElement("HR");
document.getElementById('parentdiv').appendChild(p);

edit: sorry :( nvm i fixed my problem, i forgot that i could just create a child div with the innerhtml then append it to the element, was too tired to realize this....
as a side question, ehh what should i mainly lookout for using ajax client to server 'security' suggestions?
 

TFlan

I could change this in my User CP.
Reaction score
64
Q1: It might just be my lack of sleep, but I have no idea what to decipher out of your question.

Q2: For security: All the same precautions as if you weren't running Ajax. The only thing Ajax does is make the user not have to recall the page. Everything else is the same, the script calls for data given through standard means (POST, GET, COOKIES, etc) and acts accordingly.

So initially, solve for injection of malicious codes including SQL Injection.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top