0

Hello i made a search box and i want to make a link what will pass the search word that the user put in the search box.
e.g. http://localhost/myproject/allSearches.php?searchword=aa

aa is what the user put for search. Now i want to get that, sort it and return the data.

I do this

j+= '<div>Search for all <a href="'+apiBaseUrl+'allSearches.php?search='+searchword+'">'+searchword+'</a></div';

and in allSearches.php returns nothing when in should return aa

<?php
$searchword=$_GET['search'];
?> <div><?php echo 
$searchword;
?> </div> 
2
Contributors
4
Replies
31
Views
7 Months
Discussion Span
Last Post by SimonIoa
0

Hi, do:

print_r($_GET);

inside allSearches.php and see what you get.

//Edit

Oh, wait, I'm not sure I have understood your request. You want to perform an AJAX request with the GET method?

Edited by cereal

0

No i just want to fetch the searchword=aa so that i can return data using a php function. I use jquery for the link j+= '<div>Search for all <a href="'+apiBaseUrl+'allSearches.php?searchword='+searchword+'">

0

When i do print_r it returns Array ( [searchword] => aa )

when i do echo ($_GET); returns Array

Maybe is because the link is on $.each(data, function(i,data)??

Edited by SimonIoa

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.