I'm a complete novice when it comes to this so I'm surprised I've got this far in only a couple of days. I created a mysql table to hold 3 fields of information one of which will be a URL, I've got the HTML page using Ajax search and the results are coming back fine. The only issue I have, with the code below I can't make the 'WebLink" (which is the URL including https://) turn into a clickable link, you have to copy and paste it from the screen to use it. Is there any way to do this?
// AJAX SEARCH REQUEST
var xhr = new XMLHttpRequest();
xhr.open('POST', "search.php", true);
xhr.onload = function () {
if (this.status==200) {
var results = JSON.parse(this.response),
wrapper = document.getElementById("results");
wrapper.innerHTML = "";
if (results.length > 0) {
for(var res of results) {
var line = document.createElement("div");
line.innerHTML = res['SearchCode'] + " <br /> " + res['ItemDesc'] + " <br /> " + res['WebLink'];
wrapper.appendChild(line);
}
} else {
wrapper.innerHTML = "No results found, check code and try again";
}
} else {
alert("ERROR LOADING FILE!");
}
};