Javascript和PHP的混合编程

来源:互联网 发布:淘宝的商业模式框架 编辑:程序博客网 时间:2024/05/16 10:40

其实没什么难道

写一起就行了

但是其实是各写个的,不要影响就行,程序如下:

<pre name="code" class="html"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript">function output(param) {//alert($('#myimage').attr('value'));var radiovalue=$('input[name="aaa"]:checked').val();//alert(radiovalue);$.ajax({type: "GET",//method: "Get",dataType: "json",data:{"radio": radiovalue,"imageid":$('#myimage').attr('value')},url: "Save.php",success: function(data){window.location.reload();}});}</script><?php  $m = new Mongo();// select a database$db = $m->FourS2;// select a collection (analogous to a relational database's table)$collection = $db->imagelist;$post = $collection->findOne();//element for each image$imageid = $post['_id'];$imageurl = $post['Url'];$venueid = $post['Venue_id'];$venueurl = $post['Venue_url'];$venuename = $post['Venue_name'];$strimageurl = '<center><img src=" '.$imageurl.' " width="400" height="400"></center><br>';$strimageid = '<center><div id="myimage" value="'.$imageid.'">Image_ID : '.$imageid.'</div></center>';$strvenueid = '<center><div>Venue_ID : '.$venueid.'</div></center>';$strvenuename = '<center><div>Venue_Name : '.$venuename.'</div></center>';$strvenueurl = '<center><a href="'.$venueurl.'">Venue_Url:'.$venueurl.'</a></center>';//$imageurl = explode(" ", $imageurl); //输出结果 echo $strimageurl;echo $strimageid;echo $strvenueid;echo $strvenuename;echo $strvenueurl;echo '<center><input type="radio" name="aaa" value="1"/> Yes<input type="radio" name="aaa" value="0" /> No<input type="button" style="width:70" width=70 value="next" onclick="output(this)"/></center>';// iterate through the results//echo var_dump($cursor);?>

文件名是什么都无所谓。

当你看网页源代码,你就只能看到html的代码了。

当做是两个工具就行。整体的框架还是在html里面。

原创粉丝点击