Update div with click

Asked

Viewed 970 times

0

I am using this code to update a div of the page by clicking the button

<div id="campo"></div>

function atualiza_campo_usuario(){
    $("#campo").load("http://site.com");
}

But what happens is that sometimes updates and sometimes does not update, just update by clicking 2 times,and this ends up disturbing,I need every time there is one clik, the content of the div.

Note: I make it clear that the button that updates the content of div, gets into a modal that is rescued through a iframe.

  • Rents, can you [Edit] the question and add more code? If you put one console.log('click'); within that function atualiza_campo_usuario log appears every click or you need to double-click?

  • Can you add the button code? When you add the click event to the button?

  • Taking into account that you add the event to the button, onclick or click on the page load with javascript, specifically, before loading your content, clear the div: $("#field"). Empty(); But it would be very interesting to see the code of your button.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.