It is my my first time trying to send INPUT text to URL and ALL i want is that when i search something like “cleveland”. It will go as index.php?searchText=cleveland
IN the URL.
But the output in the URL is:
index.php?searchText=c?searchText=cl?searchText=cle?searchText=clev?searchText=cleve?searchText=clevel?searchText=clevela?searchText=clevelan?searchText=cleveland
.
I can’t find any solutions online so i hope someone can explain this to me on how to fix this.
AJAX code:
function searchFilterInput(page_number) {
page_number = page_number?page_number:0;
var search = $('#search').val();
var getUrl = window.location;
$.ajax({
type: 'POST',
url: 'getData.php',
data:'page='+page_number+'&search='+search,
success: function (data) {
// Below doesn't work like it should</b>
window.history.replaceState("object or string", "Page Title", getUrl+"?searchText="+keywords);
}
});
}
2
Answers
Found the answer for people searching it here you go:
You do not need to use ajax for that, in fact you do not even need javascript to do that.