Hello,
i am using an external script to send post data which will be processed by my Site Controller, but unfortunately i am getting empty page as result on Posting, what can be the problem?
here is the posting script,running on another server:
<html>
<head>
<script src="code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
var name = "test";
var email = "abcd@abcd.com";
var phone = "4564644646";
var result;
$( document ).ready(function() {
$.ajax({
url: "mysite.com/index.php/site/myaction",
type: "post",
datatype: "text",
data: 'name='+ name + '&email=' + email + '&phone=' + phone,
success: function(result){
alert("success");
//$("#result").html(result);
},
error:function(result){
alert("error");
//$("#result").html(result);
}
});
});
</script>
</head>
<body>
<div id="result">
</div>
</body>
</html>
Url settings in config
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
here is my action:
public function actionMyaction ()
{
//print_r($_POST);
echo "yes";
}
"myaction" is also added to accessRules.
script alerts "error", and response is empty.