Search With Ajax On Click And Show Results In Same Page Laravel February 25, 2024 Post a Comment I've setup a view which contains a search form: Solution 1: It mean your form submiting to same page due to type="submit"1) change to type="button" <button type="button"class="btn"id="btn-search" > Copy2) Here click event should be for button not to div so change the selector and add e.preventDefault(); in jquery to prevent the default submit .$('#btn-search').on('click', '#btn-search', function() { e.preventDefault(); }); note :1st : your action attribute missing so form will be submit same page .Baca JugaDifference In Performance Between Calling .localecompare On String Objects And Constructing A Purpose-made Intl.collator Object?How Do I Store Multiple Jquery Selectors In A Javascript Variable?Event Listener For Input's Value Change Through Changing With .val() In Jquery?2nd : your method attribute missing so it will take default GET method Solution 2: You have given button type as submit, either remove it as<button type="button" class="btn"id="btn-search" > Search </button> Copyor use the jquery preventDeafult() function to prevent the default behavior of submit button i.e form submit in your button click event as $(document).ready(function() { $('#dateprice-search').on('click', '#btn-search', function(e) { e.preventDefault(); //your ajax code }); }); Copy Share You may like these postsHow To Refresh Jqgrid Row Id After Primary Key Is Changed In Form Edit Without ReloadJavascript Program To Check If A String Is Palindromes Not Returning FalseUnfamiliar Use Of Square Brackets During Multiple Variable Declaration In JavascriptJQuery Concatenation Of Selectors Without Creating A New Instance? Post a Comment for "Search With Ajax On Click And Show Results In Same Page Laravel"
Post a Comment for "Search With Ajax On Click And Show Results In Same Page Laravel"