php添加返回html页面的按钮并重置,PHP连接在html页面上,点击按钮进行切换_php_开发99编程知识库...

就像这样但是每次我每次刷新页面后,句子都会洗牌。 当我点击扰乱按钮时没有效果。 @Stuart Wickenden @ David Corbin

thirdChineseSentence.php

Sentence Scramble and Sequencer

otd4.jpg

Hello world

//Connect to database server

mysql_connect("localhost","root","password") or die (mysql_error ());

//Select database

mysql_select_db("login") or die(mysql_error());

//Get data from the database depending on the value of the id in the URL

$strSQL ="SELECT * FROM sentences WHERE id

ORDER BY RAND() LIMIT 1;";

//create an array with numbers 1-4

$order = array(1,2,3,4);

//shuffle them in random order

shuffle($order);

$rs = mysql_query($strSQL);

//Loop the recordset $rs

while($row = mysql_fetch_array($rs)) {

//Write the data of the person

//Display all the array values from 0-3 (array index starts from 0)

echo"

Sentence:". $row[$order[0]]."". $row[$order[1]]."".

$row[$order[2]]."". $row[$order[3]]."

";

}

//Close the database connection

mysql_close();

?>

Scramble

chinesesentence.js$(document).ready(function() {

$('#showcontent').click( function(e) {

e.preventDefault();

url = 'thirdChineseSentence.php';

$.ajax({

type: 'POST',

url: url,

dataType: 'html',

beforeSend: function() {

$("#content" ).html("Requesting.." );

},

success: function(html) {

document.getElementById("content").innerHTML=html;

}

});

});

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值