How to add links to search results from Ajax?
I have a search bar which uses Ajax implementation to search my database and query the input data.view of results generated My question is how do I make the results show up as clickable link so that when clicked they go straight to the view which holds more information about them? I have added the code for database query and the script used for accessing the database based on what was entered by the user in the search box.
<script>
$(document).ready(function()
$('#search-data').unbind().keyup(function(e)
var value = $(this).val();
if (value.length>3)
//alert(99933);
searchData(value);
else
$('#search-result-container').hide();
);
);
function searchData(val)
$('#search-result-container').show();
$('#search-result-container').html('<div><img src="preloader.gif" width="50px;" height="50px"> <span style="font-size: 20px;">Searching...</span></div>');
$.post('controller.php',
'search-data': val
, function(data)
if(data != "")
$('#search-result-container').html(data);
else
$('#search-result-container').html("<div class='search-result'>No Result Found...</div>");
).fail(function(xhr, ajaxOptions, thrownError)
//any errors?
alert("There was an error here!");
//alert with HTTP error
);
</script>
<form>
<div class="manage-accounts" id="users">
<div id="search-box-container" >
<label > Search For Any Event:
</label>
<br>
<br>
<input type="text" id="search-data" name="searchData" placeholder="Search By Event Title (word length should be greater than 3) ..." autocomplete="off" />
</div>
<div id="search-result-container" style="border:solid 1px #BDC7D8;display:none; ">
</div>
</div>
</form>
database query:
<?php
include("fetch.php");
class DOA
public function dbConnect()
$dbhost = DB_SERVER; // set the hostname
$dbname = DB_DATABASE ; // set the database name
$dbuser = DB_USERNAME ; // set the mysql username
$dbpass = DB_PASSWORD; // set the mysql password
try
$dbConnection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbConnection->exec("set names utf8");
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $dbConnection;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
public function searchData($searchVal)
try
$dbConnection = $this->dbConnect();
$stmt = $dbConnection->prepare("SELECT * FROM events WHERE title like :searchVal");
$val = "%$searchVal%";
$stmt->bindParam(':searchVal', $val , PDO::PARAM_STR);
$stmt->execute();
$Count = $stmt->rowCount();
//echo " Total Records Count : $Count .<br>" ;
$result ="" ;
if ($Count > 0)
while($data=$stmt->fetch(PDO::FETCH_ASSOC))
$result = $result .'<div class="search-result">'.$data['title'].'</div>';
return $result ;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
?>
javascript php html ajax
|
show 4 more comments
I have a search bar which uses Ajax implementation to search my database and query the input data.view of results generated My question is how do I make the results show up as clickable link so that when clicked they go straight to the view which holds more information about them? I have added the code for database query and the script used for accessing the database based on what was entered by the user in the search box.
<script>
$(document).ready(function()
$('#search-data').unbind().keyup(function(e)
var value = $(this).val();
if (value.length>3)
//alert(99933);
searchData(value);
else
$('#search-result-container').hide();
);
);
function searchData(val)
$('#search-result-container').show();
$('#search-result-container').html('<div><img src="preloader.gif" width="50px;" height="50px"> <span style="font-size: 20px;">Searching...</span></div>');
$.post('controller.php',
'search-data': val
, function(data)
if(data != "")
$('#search-result-container').html(data);
else
$('#search-result-container').html("<div class='search-result'>No Result Found...</div>");
).fail(function(xhr, ajaxOptions, thrownError)
//any errors?
alert("There was an error here!");
//alert with HTTP error
);
</script>
<form>
<div class="manage-accounts" id="users">
<div id="search-box-container" >
<label > Search For Any Event:
</label>
<br>
<br>
<input type="text" id="search-data" name="searchData" placeholder="Search By Event Title (word length should be greater than 3) ..." autocomplete="off" />
</div>
<div id="search-result-container" style="border:solid 1px #BDC7D8;display:none; ">
</div>
</div>
</form>
database query:
<?php
include("fetch.php");
class DOA
public function dbConnect()
$dbhost = DB_SERVER; // set the hostname
$dbname = DB_DATABASE ; // set the database name
$dbuser = DB_USERNAME ; // set the mysql username
$dbpass = DB_PASSWORD; // set the mysql password
try
$dbConnection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbConnection->exec("set names utf8");
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $dbConnection;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
public function searchData($searchVal)
try
$dbConnection = $this->dbConnect();
$stmt = $dbConnection->prepare("SELECT * FROM events WHERE title like :searchVal");
$val = "%$searchVal%";
$stmt->bindParam(':searchVal', $val , PDO::PARAM_STR);
$stmt->execute();
$Count = $stmt->rowCount();
//echo " Total Records Count : $Count .<br>" ;
$result ="" ;
if ($Count > 0)
while($data=$stmt->fetch(PDO::FETCH_ASSOC))
$result = $result .'<div class="search-result">'.$data['title'].'</div>';
return $result ;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
?>
javascript php html ajax
1
What you're asking for is too broad and unclear. It would be beneficial for you to go over the help area if you haven't already stackoverflow.com/help and the related links inside it. Please read through that and you'll see how Stack Overflow works, "learning the ropes" as it were. It will give you a good idea on how to formulate a good question, to see what can and should not be asked, as well as what is expected from you. This was made and put into place in order to help you have a better and positive experience here, which is what everybody wants and aims for.
– Funk Forty Niner
Nov 12 '18 at 18:53
"how do I make the results show up as clickable link"...by outputting HTML which contains the relevant hyperlink. Without more detail, we can't really tell you more than that.
– ADyson
Nov 12 '18 at 18:58
What did you receive from server? If you got the html, then the server will generate the links. If you receive only a json, then the JavaScript parser will do the job.
– Sakura Kinomoto
Nov 12 '18 at 19:01
What I get is just the title of a certain event from the database table 'Events'
– Tajh McDonald
Nov 12 '18 at 19:04
Thanks for the update. It seems you're expecting ready-made content to come back. So I suggest you change your server-side code to output HTML which includes the relevant hyperlink. If you need help with that, you'll have to show the server code.
– ADyson
Nov 12 '18 at 19:28
|
show 4 more comments
I have a search bar which uses Ajax implementation to search my database and query the input data.view of results generated My question is how do I make the results show up as clickable link so that when clicked they go straight to the view which holds more information about them? I have added the code for database query and the script used for accessing the database based on what was entered by the user in the search box.
<script>
$(document).ready(function()
$('#search-data').unbind().keyup(function(e)
var value = $(this).val();
if (value.length>3)
//alert(99933);
searchData(value);
else
$('#search-result-container').hide();
);
);
function searchData(val)
$('#search-result-container').show();
$('#search-result-container').html('<div><img src="preloader.gif" width="50px;" height="50px"> <span style="font-size: 20px;">Searching...</span></div>');
$.post('controller.php',
'search-data': val
, function(data)
if(data != "")
$('#search-result-container').html(data);
else
$('#search-result-container').html("<div class='search-result'>No Result Found...</div>");
).fail(function(xhr, ajaxOptions, thrownError)
//any errors?
alert("There was an error here!");
//alert with HTTP error
);
</script>
<form>
<div class="manage-accounts" id="users">
<div id="search-box-container" >
<label > Search For Any Event:
</label>
<br>
<br>
<input type="text" id="search-data" name="searchData" placeholder="Search By Event Title (word length should be greater than 3) ..." autocomplete="off" />
</div>
<div id="search-result-container" style="border:solid 1px #BDC7D8;display:none; ">
</div>
</div>
</form>
database query:
<?php
include("fetch.php");
class DOA
public function dbConnect()
$dbhost = DB_SERVER; // set the hostname
$dbname = DB_DATABASE ; // set the database name
$dbuser = DB_USERNAME ; // set the mysql username
$dbpass = DB_PASSWORD; // set the mysql password
try
$dbConnection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbConnection->exec("set names utf8");
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $dbConnection;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
public function searchData($searchVal)
try
$dbConnection = $this->dbConnect();
$stmt = $dbConnection->prepare("SELECT * FROM events WHERE title like :searchVal");
$val = "%$searchVal%";
$stmt->bindParam(':searchVal', $val , PDO::PARAM_STR);
$stmt->execute();
$Count = $stmt->rowCount();
//echo " Total Records Count : $Count .<br>" ;
$result ="" ;
if ($Count > 0)
while($data=$stmt->fetch(PDO::FETCH_ASSOC))
$result = $result .'<div class="search-result">'.$data['title'].'</div>';
return $result ;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
?>
javascript php html ajax
I have a search bar which uses Ajax implementation to search my database and query the input data.view of results generated My question is how do I make the results show up as clickable link so that when clicked they go straight to the view which holds more information about them? I have added the code for database query and the script used for accessing the database based on what was entered by the user in the search box.
<script>
$(document).ready(function()
$('#search-data').unbind().keyup(function(e)
var value = $(this).val();
if (value.length>3)
//alert(99933);
searchData(value);
else
$('#search-result-container').hide();
);
);
function searchData(val)
$('#search-result-container').show();
$('#search-result-container').html('<div><img src="preloader.gif" width="50px;" height="50px"> <span style="font-size: 20px;">Searching...</span></div>');
$.post('controller.php',
'search-data': val
, function(data)
if(data != "")
$('#search-result-container').html(data);
else
$('#search-result-container').html("<div class='search-result'>No Result Found...</div>");
).fail(function(xhr, ajaxOptions, thrownError)
//any errors?
alert("There was an error here!");
//alert with HTTP error
);
</script>
<form>
<div class="manage-accounts" id="users">
<div id="search-box-container" >
<label > Search For Any Event:
</label>
<br>
<br>
<input type="text" id="search-data" name="searchData" placeholder="Search By Event Title (word length should be greater than 3) ..." autocomplete="off" />
</div>
<div id="search-result-container" style="border:solid 1px #BDC7D8;display:none; ">
</div>
</div>
</form>
database query:
<?php
include("fetch.php");
class DOA
public function dbConnect()
$dbhost = DB_SERVER; // set the hostname
$dbname = DB_DATABASE ; // set the database name
$dbuser = DB_USERNAME ; // set the mysql username
$dbpass = DB_PASSWORD; // set the mysql password
try
$dbConnection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbConnection->exec("set names utf8");
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $dbConnection;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
public function searchData($searchVal)
try
$dbConnection = $this->dbConnect();
$stmt = $dbConnection->prepare("SELECT * FROM events WHERE title like :searchVal");
$val = "%$searchVal%";
$stmt->bindParam(':searchVal', $val , PDO::PARAM_STR);
$stmt->execute();
$Count = $stmt->rowCount();
//echo " Total Records Count : $Count .<br>" ;
$result ="" ;
if ($Count > 0)
while($data=$stmt->fetch(PDO::FETCH_ASSOC))
$result = $result .'<div class="search-result">'.$data['title'].'</div>';
return $result ;
catch (PDOException $e)
echo 'Connection failed: ' . $e->getMessage();
?>
javascript php html ajax
javascript php html ajax
edited Nov 12 '18 at 19:37
Tajh McDonald
asked Nov 12 '18 at 18:52
Tajh McDonaldTajh McDonald
115
115
1
What you're asking for is too broad and unclear. It would be beneficial for you to go over the help area if you haven't already stackoverflow.com/help and the related links inside it. Please read through that and you'll see how Stack Overflow works, "learning the ropes" as it were. It will give you a good idea on how to formulate a good question, to see what can and should not be asked, as well as what is expected from you. This was made and put into place in order to help you have a better and positive experience here, which is what everybody wants and aims for.
– Funk Forty Niner
Nov 12 '18 at 18:53
"how do I make the results show up as clickable link"...by outputting HTML which contains the relevant hyperlink. Without more detail, we can't really tell you more than that.
– ADyson
Nov 12 '18 at 18:58
What did you receive from server? If you got the html, then the server will generate the links. If you receive only a json, then the JavaScript parser will do the job.
– Sakura Kinomoto
Nov 12 '18 at 19:01
What I get is just the title of a certain event from the database table 'Events'
– Tajh McDonald
Nov 12 '18 at 19:04
Thanks for the update. It seems you're expecting ready-made content to come back. So I suggest you change your server-side code to output HTML which includes the relevant hyperlink. If you need help with that, you'll have to show the server code.
– ADyson
Nov 12 '18 at 19:28
|
show 4 more comments
1
What you're asking for is too broad and unclear. It would be beneficial for you to go over the help area if you haven't already stackoverflow.com/help and the related links inside it. Please read through that and you'll see how Stack Overflow works, "learning the ropes" as it were. It will give you a good idea on how to formulate a good question, to see what can and should not be asked, as well as what is expected from you. This was made and put into place in order to help you have a better and positive experience here, which is what everybody wants and aims for.
– Funk Forty Niner
Nov 12 '18 at 18:53
"how do I make the results show up as clickable link"...by outputting HTML which contains the relevant hyperlink. Without more detail, we can't really tell you more than that.
– ADyson
Nov 12 '18 at 18:58
What did you receive from server? If you got the html, then the server will generate the links. If you receive only a json, then the JavaScript parser will do the job.
– Sakura Kinomoto
Nov 12 '18 at 19:01
What I get is just the title of a certain event from the database table 'Events'
– Tajh McDonald
Nov 12 '18 at 19:04
Thanks for the update. It seems you're expecting ready-made content to come back. So I suggest you change your server-side code to output HTML which includes the relevant hyperlink. If you need help with that, you'll have to show the server code.
– ADyson
Nov 12 '18 at 19:28
1
1
What you're asking for is too broad and unclear. It would be beneficial for you to go over the help area if you haven't already stackoverflow.com/help and the related links inside it. Please read through that and you'll see how Stack Overflow works, "learning the ropes" as it were. It will give you a good idea on how to formulate a good question, to see what can and should not be asked, as well as what is expected from you. This was made and put into place in order to help you have a better and positive experience here, which is what everybody wants and aims for.
– Funk Forty Niner
Nov 12 '18 at 18:53
What you're asking for is too broad and unclear. It would be beneficial for you to go over the help area if you haven't already stackoverflow.com/help and the related links inside it. Please read through that and you'll see how Stack Overflow works, "learning the ropes" as it were. It will give you a good idea on how to formulate a good question, to see what can and should not be asked, as well as what is expected from you. This was made and put into place in order to help you have a better and positive experience here, which is what everybody wants and aims for.
– Funk Forty Niner
Nov 12 '18 at 18:53
"how do I make the results show up as clickable link"...by outputting HTML which contains the relevant hyperlink. Without more detail, we can't really tell you more than that.
– ADyson
Nov 12 '18 at 18:58
"how do I make the results show up as clickable link"...by outputting HTML which contains the relevant hyperlink. Without more detail, we can't really tell you more than that.
– ADyson
Nov 12 '18 at 18:58
What did you receive from server? If you got the html, then the server will generate the links. If you receive only a json, then the JavaScript parser will do the job.
– Sakura Kinomoto
Nov 12 '18 at 19:01
What did you receive from server? If you got the html, then the server will generate the links. If you receive only a json, then the JavaScript parser will do the job.
– Sakura Kinomoto
Nov 12 '18 at 19:01
What I get is just the title of a certain event from the database table 'Events'
– Tajh McDonald
Nov 12 '18 at 19:04
What I get is just the title of a certain event from the database table 'Events'
– Tajh McDonald
Nov 12 '18 at 19:04
Thanks for the update. It seems you're expecting ready-made content to come back. So I suggest you change your server-side code to output HTML which includes the relevant hyperlink. If you need help with that, you'll have to show the server code.
– ADyson
Nov 12 '18 at 19:28
Thanks for the update. It seems you're expecting ready-made content to come back. So I suggest you change your server-side code to output HTML which includes the relevant hyperlink. If you need help with that, you'll have to show the server code.
– ADyson
Nov 12 '18 at 19:28
|
show 4 more comments
2 Answers
2
active
oldest
votes
If all you want is making the search result clickable and browser loads the hyperlink clicked on, just echo the hyperlink from your database or JSON file depends on where they are into the html anchor element such as this:
<a href="<?php echo $row['page_link'] ?>"><?php echo $row['page_title'] ?></a>
Note: I echoed the page link in the anchor href
attribute, that should solve the problem.
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
add a comment |
You can simply add some code to make a hyperlink into the HTML your PHP is generating:
$result = $result .'<div class="search-result"><a href="http://events.php?id='.$data["id"].'">'.$data['title'].'</a></div>';
I have made an assumption about the name of your ID field but you can see the pattern you need to use.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268367%2fhow-to-add-links-to-search-results-from-ajax%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If all you want is making the search result clickable and browser loads the hyperlink clicked on, just echo the hyperlink from your database or JSON file depends on where they are into the html anchor element such as this:
<a href="<?php echo $row['page_link'] ?>"><?php echo $row['page_title'] ?></a>
Note: I echoed the page link in the anchor href
attribute, that should solve the problem.
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
add a comment |
If all you want is making the search result clickable and browser loads the hyperlink clicked on, just echo the hyperlink from your database or JSON file depends on where they are into the html anchor element such as this:
<a href="<?php echo $row['page_link'] ?>"><?php echo $row['page_title'] ?></a>
Note: I echoed the page link in the anchor href
attribute, that should solve the problem.
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
add a comment |
If all you want is making the search result clickable and browser loads the hyperlink clicked on, just echo the hyperlink from your database or JSON file depends on where they are into the html anchor element such as this:
<a href="<?php echo $row['page_link'] ?>"><?php echo $row['page_title'] ?></a>
Note: I echoed the page link in the anchor href
attribute, that should solve the problem.
If all you want is making the search result clickable and browser loads the hyperlink clicked on, just echo the hyperlink from your database or JSON file depends on where they are into the html anchor element such as this:
<a href="<?php echo $row['page_link'] ?>"><?php echo $row['page_title'] ?></a>
Note: I echoed the page link in the anchor href
attribute, that should solve the problem.
answered Nov 12 '18 at 19:09
Humarh_dharnarhHumarh_dharnarh
12
12
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
add a comment |
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
where would you recommend I place this code? So my far my attempts cause the search process to crash?
– Tajh McDonald
Nov 12 '18 at 19:19
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
In your php code that loops the result, if you may post your php script runs the code and I will highlight where you do just that.
– Humarh_dharnarh
Nov 12 '18 at 19:29
add a comment |
You can simply add some code to make a hyperlink into the HTML your PHP is generating:
$result = $result .'<div class="search-result"><a href="http://events.php?id='.$data["id"].'">'.$data['title'].'</a></div>';
I have made an assumption about the name of your ID field but you can see the pattern you need to use.
add a comment |
You can simply add some code to make a hyperlink into the HTML your PHP is generating:
$result = $result .'<div class="search-result"><a href="http://events.php?id='.$data["id"].'">'.$data['title'].'</a></div>';
I have made an assumption about the name of your ID field but you can see the pattern you need to use.
add a comment |
You can simply add some code to make a hyperlink into the HTML your PHP is generating:
$result = $result .'<div class="search-result"><a href="http://events.php?id='.$data["id"].'">'.$data['title'].'</a></div>';
I have made an assumption about the name of your ID field but you can see the pattern you need to use.
You can simply add some code to make a hyperlink into the HTML your PHP is generating:
$result = $result .'<div class="search-result"><a href="http://events.php?id='.$data["id"].'">'.$data['title'].'</a></div>';
I have made an assumption about the name of your ID field but you can see the pattern you need to use.
answered Nov 13 '18 at 9:14
ADysonADyson
23.6k112445
23.6k112445
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268367%2fhow-to-add-links-to-search-results-from-ajax%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What you're asking for is too broad and unclear. It would be beneficial for you to go over the help area if you haven't already stackoverflow.com/help and the related links inside it. Please read through that and you'll see how Stack Overflow works, "learning the ropes" as it were. It will give you a good idea on how to formulate a good question, to see what can and should not be asked, as well as what is expected from you. This was made and put into place in order to help you have a better and positive experience here, which is what everybody wants and aims for.
– Funk Forty Niner
Nov 12 '18 at 18:53
"how do I make the results show up as clickable link"...by outputting HTML which contains the relevant hyperlink. Without more detail, we can't really tell you more than that.
– ADyson
Nov 12 '18 at 18:58
What did you receive from server? If you got the html, then the server will generate the links. If you receive only a json, then the JavaScript parser will do the job.
– Sakura Kinomoto
Nov 12 '18 at 19:01
What I get is just the title of a certain event from the database table 'Events'
– Tajh McDonald
Nov 12 '18 at 19:04
Thanks for the update. It seems you're expecting ready-made content to come back. So I suggest you change your server-side code to output HTML which includes the relevant hyperlink. If you need help with that, you'll have to show the server code.
– ADyson
Nov 12 '18 at 19:28