doyz51819 2013-08-16 19:02
浏览 51
已采纳

使用AJAX / PHP将其他站点表中的内容插入到我的表单中?

My question begins below this paragraph: I have a form containing an input where someone can enter a permit number (i.e. '121640466') and once an adjacent button is clicked, a new browser tab takes you to a site that contains all of that permit's information in a tabular format:

$(".bis_button").click(function() {
    var inputValue = $(this).parent('.frm_form_field').find('input').val();
    window.open('http://a810-bisweb.nyc.gov/bisweb/JobsQueryByNumberServlet?passjobnumber='+inputValue+'&passdocnumber=&go10=+GO+&requestid=0');
});

Now, my question has several components to it that I'm hoping can help someone point me in the direction of what I'm looking to achieve:

What I essentially want is to allow someone to enter a permit number, and once an adjacent link is clicked, multiple specific fields in my form are populated with specific content from the site containing the table.

Let's use this page (we'll call it "permit page") that contains a permit's information to show what the process would look like. For this example, let's extract the Borough (Manhattan) from the table w/ heading Location Information (Filed At):

  1. On my form, enter permit number 121640466 into <input id="field_cao2yl">
  2. On "permit page", Find <table> that contains <td> w/ content "Borough" and copy the content of the next adjacent <td> (in this case, the content is "Manhattan")
  3. On my form, insert "Manhattan" into <input id="field_qeu829">

I'm hoping that this can be done with AJAX and PHP so that the page doesn't have to be refreshed to have the information from "permit page" inserted into my form's inputs.

  • 写回答

1条回答 默认 最新

  • dongzu3511 2013-08-16 19:06
    关注

    Here's how I'd do it:

    1. Accept the input from the user in your page
    2. Pass it to a PHP script using AJAX and retrieve the value in your PHP script
    3. Parse the required information using an HTML parser like SimpleHTMLDOM.
    4. Send back the results to client
    5. Populate your form fields with the values.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集