简体   繁体   English

如何使用JSON / JQUery将数据提交到外部网站并获取结果并显示在我的JSP页面中

[英]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.

相关问题 如何将java bean传递到jsp页面以便jqQrid使用json显示? - how to pass java beans to jsp page for jqQrid to display using json? 我如何在struts2的jsp页面上显示我的数据 - how can i display my data on jsp page in struts2 如何在 JSP 页面中显示列表结果? - How to display List results in JSP Page? 如何在jsp页面中将搜索结果显示为列表? - How to display search results as a list in jsp page? 当他访问网站并以用户语言显示页面时,如何在jsp页面中获得用户区域设置 - how get user locale in jsp page when he visit website and display page in user language 如何显示包含来自jsp javascript的外部网站? - How to display an external website containing javascript from jsp? 如何在struts2中使用dojo提交表单数据以进行操作以在同一jsp页面中显示结果 - how to use dojo in struts2 submit form data to action display the result in same jsp page 如何使我的“添加项目”按钮在我的JSP上运行,以便它可以将数据提交到我的数据库中 - How to get my 'Add Item' button to work on my JSP so that it can submit data into my Database 如何使用javascript从我的服务器获取数据到我的JSP? - How to get data from my Server to my JSP using javascript? 如何在jsp-servlet中将结果显示在与请求页面相同的页面上 - How to display results on same page as requesting page in jsp-servlets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM