简体   繁体   English

html php javascript表单弹出

[英]html php javascript form popup

Apologies for the ambiguous title, it just goes to show how confused I am with this one. 为这个模棱两可的标题表示歉意,这只是说明我对此感到困惑。

<a href"page.php?article_id=123&&img_id=img1">change image</a>

The link above is inside a form and is supposed to allow a user to change the image on an article. 上面的链接在表单内,并且应该允许用户更改文章上的图像。 The functional php side of things is sorted - uploading the image, changing the image etc, but this will require the main form being submitted which is fine for the initial upload - not so much for the edit. php的功能方面进行了排序-上传图像,更改图像等,但这将需要提交主表单,这对于初始上传是很好的-对于编辑而言就不那么重要了。

When the user clicks the "change image" link, I would ideally like to process that particular request alone in a different form, then update the parent page. 当用户单击“更改图像”链接时,理想情况下,我希望单独以不同的形式处理该特定请求,然后更新父页面。 I thought of doing it with a javascript new window popup which would have been ideal, except that I can't figure out how to pass the article_id as well as the img_id to the new popup page but above all... is this the most efficient way of doing this nowadays? 我想到了用一个理想的javascript新窗口弹出窗口来做这件事,只是我不知道如何将article_idimg_id传递给新的弹出页面,但最重要的是……这是最如今最有效的方法?

If not, How do I carry out this task? 如果没有,我该如何执行此任务? I have thought of ajax, jquery... but the same issue of passing the article_id and img_id still limits me. 我曾经想到过ajax,jquery ...,但是传递article_idimg_id的同一问题仍然限制了我。

I hope all of this makes sense and thanks in advance 我希望所有这些都是有道理的,并预先感谢

ps: An article can have multiple images and article id is dynamic. ps:一篇文章可以包含多个图像,并且文章ID是动态的。

ajax sounds good to me. 阿贾克斯听起来对我很好。 may be you try something like this (jquery)?! 可能您尝试过这样的事情(jquery)?

$.ajax({
  type: "POST",
  url: "page.php",
  data: { article_id: 123, images: { i1: "img1", i2: "img2" } }
}).done(function( msg ) {
  alert( "done: " + msg );
});

for further information and examples: http://api.jquery.com/jQuery.ajax/ 有关更多信息和示例,请访问: http : //api.jquery.com/jQuery.ajax/

检查一下: http : //www.malsup.com/jquery/form/-jQuery是先决条件,但插件允许您通过ajax发送表单元素,包括使用简单API的文件字段,并且为您完成了所有繁重的工作。

why cant u receive article_id and img_id? 您为什么不能收到article_id和img_id?

if you use: 如果您使用:

<a href"#" onclick="window.open('page.php?article_id=123&&img_id=img1', 'window1');">edit</a>

u can get article_id and img_id in $_GET 您可以在$ _GET中获取article_id和img_id

however, this is a oldfashioned way getting this done. 但是,这是完成此操作的老式方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM