Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:52:22+00:00 2026-06-11T21:52:22+00:00

I started exploring ajax, and somehow I’m fine with it, not too hard and

  • 0

I started exploring ajax, and somehow I’m fine with it, not too hard and not easy just normal. Anyway I am having a difficulty with this project I have. It involves ajax, php, js, mysql. I am actually trying to copy Facebook’s tagging style. When you tag someone in a post, the full name turns to a hyperlink that directs to the tag users profile. It’s only a minor problem I feel, its just that I am new to JS as well. I did the rest already, but I am having a problem turning the text to a hyperlink with js. I want it in the putin_livesearch() the code.

This is my Code.

index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FB TAG</title>

<style>

.namesearch {
    cursor:pointer;

}


</style>

<script type="text/javascript">


function putin_livesearch(fname, lname) 
{

//document.getElementById('searchbar').value = (fname + " " +lname);

//document.location.href='#'+ window.document.getElementById('searchbar').value = (fname);

window.document.location.href="#"+window.document.getElementById('searchbar').value;

}



function showResult(str)
{
if (str.length==0)
  {
  document.getElementById("livesearch").innerHTML="";
  document.getElementById("livesearch").style.border="0px";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("livesearch").innerHTML=xmlhttp.responseText;
    document.getElementById("livesearch").style.border="1px solid #A5ACB2";


    }
  }
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>

<body>
<form>
  <input id ="searchbar" name="wallpost" type="text" onkeyup="showResult(this.value)"  />
  <div id="livesearch"></div>
</form>
</body>
</html>

getuser.php

<?php
$q=$_GET["q"];

$con = mysql_connect('localhost', 'root', '');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("place_main", $con);

$sql=" SELECT * FROM profiles WHERE firstname like '".$q."%' ";

$result = mysql_query($sql);



while($row = mysql_fetch_array($result))
  {
  $fname = $row['firstname'];
  $lname = $row['lastname'];


  echo '<span class ="namesearch" onclick="putin_livesearch(\''.$fname.'\',\''.$lname.'\'  )"> '. $fname ." ". $lname .' </span><br />';


  //echo "<span class ='namesearch' onclick='putin_livesearch(" .$fname. ", " .$lname. " )'> " . $fname . " " . $lname . "</span><br />";
  }


mysql_close($con);
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:52:23+00:00Added an answer on June 11, 2026 at 9:52 pm

    Okay I guess what I am trying to is not possible. To the test I actually tried adding a value in a text area with an tag. It does not turn it to a link. Did some inspecting in fb actually while tagging a friend with @ in the wallpost doesnt put it to a link, but afterwards when posting it does.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently started exploring using AJAX for a small project, and I've had reasonable
Just started exploring Cocoa so pretty much a total noob. I've written a very
I have just started exploring TWILL . Twill is an amazing scripting language for
I just started exploring Java Servlets and JSP and am a little confused about
I just started exploring Scala in my free time. I have to say that
I have just started exploring SpringMVC and logback. This is my controller, (the only
I have just started this week in exploring Android Open GL ES and related
I am a newbie just started exploring Grails so that I can recommend this
Just started exploring the API. I'm trying to get some documents' metadata via the
I have just started exploring Couchbase Mobile for Android and have been impressed with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.