So I have this JS code:
myClass = new Class({
initialize: function() {
this.btnSubmit = document.id('btnSubmit');
this.sendData = new Request({
"url":"/",
"method":"post",
"data": {"option":"com_my4quiz", "controller":"conduit", "task":"save", "hrdata":"foo"},
"onSuccess": this.handleResult.bind(this)
});
this.btnSubmitObserver = function() { this.sendData.send(); }.bind(this);
this.btnSubmit.addEvent("click", this.btnSubmitObserver);
},
handleResult: function(stuff) {
//do stuff
}
});
If I'm posting this to my Joomla 3.2.0 component it returns the home page. As soon as I switch to get, it sends the data to the correct place and I get what I expect.
I think its due to your controller page loads the entire view.
This may happen due to inside your controller
save(). function not rendering any specific view .So the solution is after the Ajax result just render the proper layout or just put an
exit();At the end of your
save()or
Hope its helps..