使用JQuery表单插件将表单数据发布到cakephp控制器

使用JQuery表单插件将表单数据发布到cakephp控制器,jquery,cakephp,forms,Jquery,Cakephp,Forms,我正在使用JQuery的表单插件。。 我添加了表单插件的js文件 我的代码中已经有一个表单..在正确提交实际表单内容之前,我想将此值发布到我的服务器端..我尝试了以下操作,但不起作用 我的代码是 <?php echo $form->create('Result',array('action'=>'submit'));?> //some input text fields,texarea fields <?php echo $form->end('submit'

我正在使用JQuery的表单插件。。 我添加了表单插件的js文件

我的代码中已经有一个表单..在正确提交实际表单内容之前,我想将此值发布到我的服务器端..我尝试了以下操作,但不起作用

我的代码是

<?php echo $form->create('Result',array('action'=>'submit'));?>
//some input text fields,texarea fields
<?php echo $form->end('submit');?>

 <script>
  $(document).ready(function(){
  var options = { 

    beforeSubmit:  showRequest,  // pre-submit callback 
    success:       showResponse,  // post-submit callback 
     url: "http://localhost/cake_1.2.1.8004/index.php/results/submit1",
    type: 'POST',
    resetForm: true        // reset the form after successful submit 

}; 


$('#ResultSubmit1Form').submit(function() { 

    $(this).ajaxSubmit(options); 


    return false; 
}); 


 });//ready 

    // pre-submit callback 
 function showRequest(formData, jqForm, options) { 

var queryString = $.param(formData); 


alert('About to submit: \n\n' + queryString); 

     $.ajax({
      type: "POST",
     url: "http://localhost/cake_1.2.1.8004/index.php/results/submit1",
     data: "str="+queryString,

    success: function(msg){
     alert( "Data Saved: " + msg);
    }

        }); 


return true; 
} 

   // post-submit callback 
  function showResponse(responseText, statusText)  { 


alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
    '\n\nThe output div should have already been updated with the responseText.'); 
 } 

}尝试使用相对URL作为URL参数:

 url: "/cake_1.2.1.8004/index.php/results/submit",
最好在服务器端回显一些文本,以确保不是服务器输出失败


编辑:我可以看到你已经这么做了,很抱歉没有注意到。

ya我已经用你提供的Url尝试过了。。实际上,例如,我的Querystring输出将是_method=POST&name1=value1&name2=value2,但现在只有_method=POST被回显。。。
  var $name = 'Results';
 var $helpers=array('Html','Ajax','Javascript','Form');
   var $components = array( 'RequestHandler','Email');
  var $uses=array('Form','User','Attribute','Result');
 function submit($id = null)
 {

  $str=$_POST['str'];
echo "POSTED value ".$str;

}
 url: "/cake_1.2.1.8004/index.php/results/submit",