Reputation: 9
I am getting dataArray
to insertAction and sending mysql function where I am inserting data to table. When uri is domain.com/v2/translate
it's working but when uri is domain.com/v2/translate/lid/2
for example, than Phalcon is causing about routes! And I have this routes define .
$('.save').click(function(e){
var langKeyId = $(this).prev('input').attr('id');
var translateText = $(this).prev('input').val();
var lid = $(this).prev('input').attr('data-lid');
var dataArray = [langKeyId, translateText, lid];
$.ajax({
type: "POST",
url: "translate/insert",
data: {dataArray : dataArray},
success: function(r) {
$(this).disabled = true;
}
});
});
Upvotes: 0
Views: 63
Reputation: 2003
Instead of using
url: "translate/insert"
use
url: "/translate/insert"
or an absolute path like url: "http://domain.com/v2/translate/insert"
If you use the URL without the leading '/' you are actually doing an ajax call to domain.com/v2/translate/lid/2/translate/insert
.
Upvotes: 1