In my program i have written the jquery like below:
$(document).ready(function() {
$("#toggle").click(function() {
$.post("/project/addhighlight", {
name: "Donald Duck",
city: "Duckburg"
},
function(data, status){
var dataconverted = jQuery.parseJSON(data);
$("#mytext").text(dataconverted);
if (status == "success") { }
});
});
})
What i want to do is to change the $.post
url(/project/addhighlight
) to the one returned by the backend method once the post is success.
Can any one please advice on how to do it?