I have the following sript:
$('a[id^=asociar-]').click(function (e) {
e.preventDefault();
var params = {
id: parseInt($(this).attr('id').substring(8)),
proveedorId: $('#proveedorId').val()
};
var asociado = $(this).find('input').val();
var actionName = (asociado === 'False') ? 'Asociar' : 'Desasociar';
var jsUrl = '@Url.Action("##", "Administrador")';
$.ajax({
url: jsUrl.replace('##', actionName),
type: "post",
data: params,
cache: false,
success: function (result) {
if (result.flag) {
$("#asociar-" + params.id).removeClass("fa-square-o").addClass("fa-check-square-o");
}
}
});
});
I need the ActionName to be dynamic according to the condition, in the script the Replace is not working inside the ajax, it generates the error:
NetworkError: 404 Not Found - link Administrator /% 23% 23 "
Any ideas on how to achieve this?