使用AJAX在JSP中调用Servlet URL [英] Servlet URL call in JSP using AJAX

查看:184
本文介绍了使用AJAX在JSP中调用Servlet URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Appreciate if someone could assist me on this.... i have a servlet coded already (Its a http url). I would need to access the servlet in JSP to get the data using ajax.

can someone tel me how to obtain this?

url link below is given for sample.... $.ajax({ type: 'GET', data : { }, url: 'http://testurl/testconnection.jsp?action=getsearchresults',
success: function(data) { console.log(data);
});









我是Ajax的新手,不知道如何在Ajax中传递我的servlet并在jsp中检索数据。



任何专家协助都将受到高度赞赏。谢谢



我的尝试:







I am new to Ajax, not sure how to pass my servlet in Ajax and retrieve the data in jsp.

Any experts assistance would be highly appreciated. Thanks

What I have tried:

$.ajax({ type: 'GET', data : { }, url: 'http://testurl/testconnection.jsp?action=getsearchresults',
success: function(data) { console.log(data);
});

推荐答案

.ajax({type:'GET',data:{},url :'http://testurl/testconnection.jsp?action = getsearchresults',
success:function(data){console.log(data);
});
.ajax({ type: 'GET', data : { }, url: 'http://testurl/testconnection.jsp?action=getsearchresults', success: function(data) { console.log(data); });

< br $> b $ b





我是Ajax的新手,不知道如何在Ajax中传递我的servlet并检索数据在jsp。



任何专家协助都将受到高度赞赏。谢谢



我的尝试:







I am new to Ajax, not sure how to pass my servlet in Ajax and retrieve the data in jsp.

Any experts assistance would be highly appreciated. Thanks

What I have tried:


.ajax({type:'GET',data:{},url:'http://testurl/testconnection.jsp?action = getsearchresults',
成功:function(data){console.log(data);
});
.ajax({ type: 'GET', data : { }, url: 'http://testurl/testconnection.jsp?action=getsearchresults', success: function(data) { console.log(data); });


这篇关于使用AJAX在JSP中调用Servlet URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆