weixin_33698823 2015-03-30 09:58 采纳率: 0%
浏览 4

jquery对话框与ajax

i want to replace my popup with ajax-dialogs. For example :

i have a input field for article-numbers.

<span>article-no</span><input type='text' id='article_no'>

now if you klick on the text article-no a popup (new window) opens and you can search the article via searchfields. You can enter searchwords and a table with matching articles will be shown. if you select an article in the table the popup closes an the article-no in the opener will be filled. That works, but i want to have no popups.

i searched the weekend for jquery dialogs. But i found no example that has dynamic content. i mean that i show a searchform in the dialog and if you search in it, the table with matching articles(created via ajax call) should be shown in the dialog so you could select the right article.

can anybody give me tipps how to get this?

bya jogi

  • 写回答

1条回答 默认 最新

  • weixin_33709609 2015-03-30 10:14
    关注

    You can accomplish this via ajax, by implementing a flow like this:

    1. when "article-no' is clicked call the dialog() jquery-ui function, and launch an ajax call; optionally you can either supply a "loading" css class for the dialog div, or set a "loading" html content
    2. on ajax success handler set the html content of the dialog div to the one received from server
    3. now the problem is with the search form, as the popup implementation took care by that by reloading the page with the search results, you'll need to intercept the submit event on the search form and make another ajax call, with the same success handler setting the dialog div html; again you can supply a loading indicator to the user
    4. you will need to also intercept the click events on the search results in order to fill the article contents on the main page

    Note. You can use the jQuery.load() function instead of the jquery.ajax() one as it makes it easier to write the ajax calls.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?