custom href giving 404 error
custom href giving 404 error
![lieyongchang](https://secure.gravatar.com/avatar/3e190812f690451db882975662de1074/?default=https%3A%2F%2Fvanillicon.com%2F3e190812f690451db882975662de1074_200.png&rating=g&size=120)
$(document).ready(function() {
var editor = $('#users').DataTable({
"processing" : true,
"responsive": true,
"ajax" : {
"url" : "findall",
"dataSrc":"",
"type" : "POST",
"dataType" : "json",
"contentType" : "application/json",
"data" : function(d) {
return JSON.stringify(d);
}
},
"columns": [
{"data": "id"},
{"data": "name"},
{"data": "age"},
{"data": "gender"},
{"data": "country"},
{"data": "email"},
{"data": "mobile"},
{"data": "contact"},
{"data": "birthdate"},
{"mRender": function ( data, type, row ) {
return '<a href="@{/edit/{id}(id=${user.id})}">Edit</a>';}
},
{"mRender": function ( data, type, row ) {
return '<a href="@{/delete/{id}(id=${user.id})}">Delete</a>';}
}
]
});
});
clicking on the href is giving me 404 error. anyone encounter this before?
This discussion has been closed.
Replies
The place to start is to look at your server log to find out why its returning the 404 not found error.
Kevin
its a 500 error, as shown below the screenshot, which does not tells me much![:( :(](https://datatables.net/forums/resources/emoji/frowning.png)
Thats a 500 Internal Server error. Both 404 and 500 errors are error responses from the server. You will need to look at the web server logs to find out why the server script is responding with those codes. There is nothing that can be debugged from the client for these errors.
Kevin
How do i check server log?? i went to the network tab that is what it is showing me
this is the correct url i was expecting:
but somehow when i click the button, the return url is
previously i was using it this way and it return me the correct
i use the same href, but it is not working for this..confuse @kthorngren
Do you have a web server running on your locahost to receive the request for
http:localhost:8080/....
?Doesn't seem like what you have following that URL
@%...
is valid. You are building the URL like this:I don't think the macro you have will work in the
columns.render
. Maybe something like this:Might not be exactly right but hopefully it will get you started. See this example and the URL example in the
columns.render
docs.Kevin
so i change it to this, since i need row.id to be dynamic , and i use parseInt(row.id), as row.id returns a string but i need it to be long.
but i am getting this error. Is there a way to change my int to long? or directly from string to long??
so what i have also tried is, at my backend, i try and change it to int, but still getting the same error
Since you are imbedding it into a string it doesn't really matter if its an int or long because its being converted to a string. Maybe the problem is the quotes around the number. Notice the error has
For inout string: ""1""
. You will need to look at the docs for the URL recipient to see how to format the URL.Kevin
this is the correct format. I am going to leave it here, for people that needs it in the future.