jQuery.ajax post从select标记返回从onchange事件调用的页面的整个html
jQuery.ajax post returning whole html of the page called from onchange event from a select tag
我想使用ajax将值从js文件发布到magento中的phtml文件,基本上,问题出在成功时,它会用页面的html代码来警告,从doctype开始直到结束。我想得到正确的值,因为我需要在通过PHP调用的一个magento函数中使用它。
这是我在更改时调用的函数:
function getsingproduct(id)
{
var str = 'product' + id;
var currentselecteditem;
ele = document.getElementById("product" + id);
currentselecteditem = ele.options[ele.selectedIndex].value;
jQuery.ajax({
type: 'post',
data: {
curr_item: currentselecteditem
},
success: function (data) {
jQuery('#testing').text(data);
alert('data ' + data);
},
});
}
下面是一些javascript代码:
$.ajax({
type:"POST",
url: "new_prob_submit.php",
data: {
curr_item: currentselecteditem
},
dataType: "json",
success:function(data){
alert(data);
}
});```
相关文章:
- 从.js文件调用html中的js函数
- 当 Node.js 调用 HTML 时,外部 Javascript 和 CSS 不会对 HTML 产生影响
- 通过express路由调用HTML中的Javascript函数
- 在ASP中调用HTML以调用其他脚本
- 调用html()之前需要执行unbind()还是off()
- 用于调用 html 页面的内容窗格查询
- 如何检测何时在 jQuery 中调用 .html() 函数
- 如何使用在 jscript 中声明的参数调用 Html.RenderAction()
- 在iframe中使用jquery-mobile调用html页面
- magnific弹出窗口在调用.html内生成的类时不起作用
- 如何在javaScript中调用HTML选择值
- 如何使用css,js和图像调用HTML文件
- 使用 javascript 调用 html 中标签的下载
- 未调用HTML中的Javascript函数
- 调用html body标记中的脚本函数
- 使用sl4a中的webViewShow调用HTML
- IE中并不总是调用HTML页面卸载
- 如何才能只调用html文件的一行
- 使用变量或JavaScript动态调用HTML文件以给出搜索结果
- 当调用HTML时,如何显示HTML文件中的特定表以及多个表