Ext3跨域ScriptTagProxy使用

1.Ext3跨域问题须要用ScriptTagProxy解决,官网查询例子以下chrome

2.若是是增删改则以下,JsonStore不定义数据格式json

3.能够用chrome看到跨域访问的原理:服务端传送过来的不是json而是js文件跨域

4.关于load的回调处理ui

new Ext.data.JsonStore({
		id: 'mytableUpdateStore',
		root : 'code',
		fields : [{name : 'code'}],
		autoDestroy : true,
		proxy: new Ext.data.ScriptTagProxy({
                    url: 'http://localhost:8080/server/mytable/update.do'
                })
	});
function doAfterEdit(event) {
	Ext.StoreMgr.get('mytableUpdateStore').load({
		params : {
			uuid : event.record.get('uuid'),
			field : encodeURI(event.field),
			newValue : encodeURI(event.value)
		},
		callback : function(r, options, success) {
			if(success) {
				event.record.commit();
			}
			else {
				Ext.MessageBox.alert('提示', '更新错误,请联系管理员!', null);
			}
		}
	});
}

缘由正是由于返回来的再也不是那个成功的code-200,而是下面的文段:url

因此它执行了success==false的方法code

相关文章
相关标签/搜索