I made HTML page that have form, when submitting, it calls JavaScript by using this event handler.
onClick = operation(this.form)
and the JavaScript is:
function operation(x) {
//url:"C:\Users\jhamb\Desktop\assignment_1_18_1_13\question_3\ques\form1.html",
url:"http://localhost:8080",
$.ajax({
data:{
comment:x.comment.value, // information from html page
email: x.email.value, // information from html page
url:x.url.value, // information from html page
name:x.name.value, // information from html page
}
}).done(function(serverResponse){
alert("response is ready"); //here you can handle server response
}).fail(function(err){
alert("ohhh!!! there is some error"); //here you can handle errors
});
//alert(obj.details[3].comment_value);
}
Now what I want is to communicate between server and client , that is on same system.
My code is not working. Now what can I do, please help.
first i don’t think your server listens on port 8080, that normaly aport for the admin software.
second you have to put the url inside the ajax request
you shoul also add
dataType(html or json), the sendingtype(post, get etc.) in the param list