dce*_*con 1 html javascript jquery post
我有一个页面base.html,我在index.php上有一个链接:
<a id="goTo" href="#">go to...</a>
Run Code Online (Sandbox Code Playgroud)
所以,我需要使用jQuery库在index.php发送一个像param ='myValue'这样的POST消息.我试过用这个脚本:
<script type="text/javascript">
$(document).ready(function(){
$('#goTo').click(function() {
event.preventDefault();
alert('Ok!');
$.ajax({
method: 'POST',
data: 'param=MyValue'
url: 'index.php',
});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
但是不能像我想的那样工作.我该怎么办?
编辑 我需要进入index.php而不是保留在base.html中.
| 归档时间: |
|
| 查看次数: |
813 次 |
| 最近记录: |