Skip to content
Snippets Groups Projects
Commit abebeeb3 authored by jsclose's avatar jsclose
Browse files

implemented the connection between search and returning data

parent bdefbc7d
No related branches found
No related tags found
1 merge request!9Website
No preview for this file type
......@@ -192,6 +192,21 @@ void *Talk( void *p )
potentialSearch = potentialSearch.erase(0, 8);
std::cout << potentialSearch << std::endl;
std::cout << "Returning results" << std::endl;
std::string okMessage = "HTTP/1.1 200 OK\r\n"
"Content-Length: ";
okMessage += ( potentialSearch.size( ) );
okMessage += "\r\nConnection: close\r\nContent-Type: ";
okMessage += "text/plain";
okMessage += "\r\n\r\n";
std::cout << "Sending" << std::endl;
std::cout << okMessage;
send( s, okMessage.c_str( ), okMessage.length( ), 0 );
send( s, potentialSearch.c_str( ), potentialSearch.length( ), 0 );
close( s );
}
else
{
......
......@@ -11,14 +11,14 @@ $(function () {
function get_request(artist_name){
$query = $("#query").val();
console.log("Making a query");
$.ajax({
url: "/search",
type: 'GET',
contentType: "text/plain",
data: $query,
dataType: 'json',
dataType: 'text/plain',
success: function (data) {
......@@ -28,7 +28,8 @@ function get_request(artist_name){
},
error: function (data) {
console.log(data);
console.log("error");
console.log(data.responseText);
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment