I have a function that is triggered when a link is clicked. This function uses ajax to load a new page over a div.
<pre><code>
function displayContent(id)
{
loadPage_signup = "register.php";
loadPage_info = "userinfo.php";
$.ajax({
url:"register.php",
dataType: 'html',
success:function() {
$("#user_info_container").load(loadPage_info);
$("#signup_header").load(loadPage_signup);
}
});
}
</code></pre>
Once the new page is loaded using ajax, there is a cancel button present on that page. Clicking this cancel button should remove the ajax-loaded content and show the original content in the div.
I tried writing a function for this functionality but it's not working as expected. The ajax-loaded content gets removed, but the original contents of the div do not appear. Can someone please help me figure out what's causing the issue?
<pre><code>
function hideDiv(id) {
$(id).remove();
$ret = $("#signup_header").show();
$("#signup_header").nextAll().show();
}
<input type="button" id="cancel_button" name="btnCancel" value="Cancel" onClick="hideDiv('#signup_header')" />
</pre></code>