<script> var images = document.getElementsByClassName("c1"); var imageStr = ""; for(var i=0;i<images.length;i++){ imageStr+=images[i].src+'_'; } alert(imageStr); </script>
如何设定一个按钮,点击后post imagestr里面的数组到php
$imageStr = "http://127.0.0.1/down/123.gif__http://127.0.0.1/down/8095680852_893f685cbd_q.jpg__http://127.0.0.1/down/8018953043_c6ef9e3b29_q.jpg__";
提问前请先搜索相关答案:
https://segmentfault.com/sear...
<script> var images = document.getElementsByClassName("c1"); var imageStr = ""; for(var i=0;i<images.length;i++){ imageStr+=images[i].src+'_'; } alert(imageStr); </script>
如何设定一个按钮,点击后post imagestr里面的数组到php
$imageStr = "http://127.0.0.1/down/123.gif__http://127.0.0.1/down/8095680852_893f685cbd_q.jpg__http://127.0.0.1/down/8018953043_c6ef9e3b29_q.jpg__";
提问前请先搜索相关答案:
https://segmentfault.com/sear...
例子
立即学习“PHP免费学习笔记(深入)”;
$( "#lock_submit").click(function (){ var lock_form = $("#lock_form").serialize(); // 参数带在form里面用form表单 var onePush = "xxx/xxx/xxx.php" ; var imageStr ="http://127.0.0.1/down/123.gif__http://127.0.0.1/down/8095680852_893f685cbd_q.jpg__http://127.0.0.1/down/8018953043_c6ef9e3b29_q.jpg__"; $.ajax({ url: onePush , type:"POST", data:{image:imageStr},//data:lock_form form提交 dataType : "json", success :function(data){ if(data.status== 1){ alert('操作成功') // 刷选页面 location. reload(); }else{ alert('操作失败') } } }) })
表单提交就可以了
$.post(url,{imageStr:$imageStr},function(res){
//do somethings
})
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号