Reply To: Prevent page reload

#4582
Matt Stern
Participant

Thanks a lot for your help – it has really guided me in the right direction to solve my issue. I believe I solved my issue by doing the following –

I moved all of my forms onto another page – not separate pages though, one single page.

I now have the following ajax/jquery code running that handles showing the correct form when it is selected:

;(function($){
var ahref1;
$(document).ready(function(){
  $(document).on('click', '.entry-content li a', function(e){
    e.preventDefault();
    ahref1 = $(this).attr('href');
    $('#formloader').load('/testpage ' + ahref1);
    return false;
  });
});
$(document).ready(function(){
  $(document).on('click', '.entry-content #formloader a', function(e){
    e.preventDefault();
    var ahref2 = $(this).attr('href');
    $('#formloader').load(ahref2 + ' ' + ahref1);
    return false;
  });
});
})(jQuery);

This seems to work exactly as intended – once again, thank you for your time!