使用& lt; a>用ajax标记
Using <a> tag with ajax
我有以下代码,它正在工作,但我想使用( <a> )
标签而不是( <input type='submit'> )
。我是php的初学者-我希望我的问题将被娱乐。我用谷歌搜索过我的问题,但是没有帮助。
<html>
<head>
<script type="text/javascript">
function load(thediv, thefile)
{
//alert('works');
if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function(){
if(!(xmlhttp.readystate == 4 && xmlhttp.status == 200))
{
// alert('works');
document.getElementById(thediv).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET', thefile, false );
xmlhttp.send();
}
</script>
</head>
<body>
<input type='submit' value="submit" onclick='load('main','itc_result.php');'>
</body>
你可以这样做:-
<a onclick="load('main','itc_result.php');">Click Me </a>.
但它需要什么还不清楚?
favorite
i have following code and its working but i want to use ( <a> ) tage instead of "( <input type='submit'> ) " i am a beginner in php, hope my question will be entertained, i have goggled my problem but it didn't help me
<html>
<head>
<script type="text/javascript">
function load(thediv, thefile)
{
//alert('works');
if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function(){
if(!(xmlhttp.readystate == 4 && xmlhttp.status == 200))
{
// alert('works');
document.getElementById(thediv).innerHTML = xmlhttp.responseText;
}
}
alert('sending ajax');
xmlhttp.open('GET', thefile, false );
xmlhttp.send();
}
</script>
</head>
<body>
<div id="main" />
<a href="#" onclick="load('main','itc_result.php');" >submit</a>
</body>
将上述内容添加到锚标记的onclick中,像这样
<a href="#" onclick="load('main','itc_result.php');" >submit</a>
相关文章:
- 需要将select标记选项值传递给ajax函数
- php使用ajax创建了select标记
- 什么's使用脚本标记调用文件和ajax之间的区别
- Gmaps4rails:What'这是通过AJAX添加标记后启用集群的正确方法
- jQuery没有在ajax请求的脚本标记中加载js文件
- GoogleMapsForRails-只有在搜索结果发生变化时才通过ajax更新标记
- 错误:使用ajax.get时,元素后应为]标记
- 如何在未定义类时从 AJAX 响应中获取锚标记值
- 谷歌地图API-在从ajax页面加载新数据之前清除标记、多段线
- AJAX请求替换整个页面标记
- 异步HTTP(ajax)请求在脚本标记中有效,但在js文件中无效
- 谷歌地图标记不显示ajax json数据
- 从Json Ajax响应中剥离标记
- 允许select2jquery-ajax在标记模式下重复标记
- 撇号标记在javascript字符串中与Backslash一起发送,该字符串使用ajax作为json对象的一部分发送到p
- 如何迭代数据为谷歌地图创建标记(使用express/jquery/ajax)目前正在获取SyntaxError
- 当通过ajax动态添加标记时,Wicket-IE8-Javascript事件侦听器不会执行
- PHP-AJAX复选框过滤器使用数据标记属性
- 堆栈溢出背后的算法是什么? ajax标记搜索字段
- 使用& lt; a>用ajax标记