So, I've created a plugin which has to send dynamic data to an entry in the control panel, using a custom field type
I get an error in the ajax call, saying that the URL to which I'm posting is not found. I've debugged this and the URL generated is the right one, I've tried posting to it from other places and it works just fine
This is what I have so far
The custom field
public function getInputHtml($name, $value)
{
craft()->templates->includeJsResource('baseinstagram/js/pullajax.js');
return craft()->templates->render('baseinstagram/input/choosetag', array(
'name' => $name,
'value' => $value
));
}
The ajax call
$(document).ready(function () {
var url = Craft.getActionUrl('baseinstagram/main/testy');
$('.pullme').click(function () {
$.ajax({
method : 'POST',
url : url,
success : function () {
console.log('ok');
},
error : function() {
console.log('nope');
}
});
});
});
the controller
public function actionTesty() {
$this->requireAjaxRequest();
$this->returnJson('heyeyeye');
}