它是如何/(或仅仅是"它?")可以创建一个Web组件,可以放在一个表单中,并像任何输入元素一样,在提交时发送到服务器?换句话说,Web组件可以用于创建自定义输入元素吗?
我正在尝试使用jQuerys post-function将表单发布到CakePHP脚本.
像这样:
jQuery的:
$('#submit_btn').click(function(){
//Code to prevent redirect
dataString = 'test=testdata';
$.post('cakephp/forms/output', dataString, function(response){
alert(response);
})
});
Run Code Online (Sandbox Code Playgroud)
CakePHP的
function output(){
pr($this->data); # Print nothing
pr($_POST); # Print test => testdata
$this->render('view','ajax'); # Render ajax-friendly
}
Run Code Online (Sandbox Code Playgroud)
所以$_POST不是空的但是$this->data......怎么样?
发布数据的表单元素i来自aja,如果这是在这种情况下重要的事情.
由于我在CakePHP中使用Auth,localhost/mysite/cakephp总是重定向到localhost/mysite/cakephp/users/login.
我要求的是一个简单的方法来隐藏起始页上的网址"/ users/login"..?