Is it a possible using windows.location.replace
to redirect to ItemID.
Like, I have one input text
and button
and when user input like 123
and if this item exist in database it need to redirect to this item.
$.ajax({
type: "GET",
URL: "/api/Akontas/GetAKONTA",
data: { id: $('#AkontasId').val() },
contentType: "data/xml; charset=utf-8",
success: function (result) {
window.location.replace("http://localhost:57285/api/Akontas/" + $('#AkontasId'));
},
error: function () {
alert("Ne postoji AKONTO pod tim rednim brojem");
}
});
Something like this if exsist return xml data
Otherwise return No data found with this ID
Update