[英]How to submit data to external website using JSON /JQUery and get the results and display in my JSP page
I am new to json and JQuery for clipping html elements from external URL.I tried reading couple books but didn't get it from where and how to start. 我是json和jQuery的新手,可以从外部URL剪切html元素。我尝试阅读几本书,但没有从何处以及如何开始获取它。
example how i need. 我需要的例子。
i have a jsp page which has text field and button,I entered "java tutorials" and click on button. 我有一个带有文本字段和按钮的jsp页面,我输入了“ java教程”并单击了按钮。 then it should go to the google.com and paste the string in the text field and click on the google serach.
那么它应该转到google.com,并将字符串粘贴到文本字段中,然后点击google serach。 can anyone please help me how this can be achieved using json and jquery.
谁能帮我使用json和jquery做到这一点。
Thanks in Advance. 提前致谢。 Srikanth.
SRIKANTH。
You do not need JSON data in order to submit your input information to googles search page. 您不需要JSON数据即可将输入信息提交到Google搜索页面。 I mean you should not go to googles page and input data to search box and click search.
我的意思是,您不应该转到Google页面并在搜索框中输入数据,然后单击搜索。 What you should do is redirect user to google like following:
您应该做的是将用户重定向到Google,如下所示:
In jquery after DOM ready 在DOM准备好之后的jquery中
$(document).ready(function()
{
$('#submit').click(function()
{
window.location.href='https://google.com/?q='+$('#query_data').val();
});
});
HTML for this is as following (inside of form tag): HTML如下(在表单标签中):
<input type="text" id="query_data">
<input type="button" id="submit" value="Submit">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.