1

I have the javascript code that ONCLICK retrieves text from another PHP file and Puts it in DIV. The main code works, but I need to ADD retrieved text to Div content. Instead of that, it´s replacing content of DIV with retrieved text.

  $.post("getdata/some.php",{partialStates:option.value},function(data){
  $("#some").html(data);

Div id=some

Thanks in advance.

1
  • Use append() or retrieve the html first, add your data, then set it? Commented Feb 7, 2015 at 11:18

1 Answer 1

3

Try the jquery append method

$('#some').append(data);

instead of

$('#some').html(data);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.