如何根据响应调用change-ajaxurl


how to call change ajax url based on response

如何根据响应调用change-ajax-url

$.ajax({
    url: "/url/1/1",
    dataType: "json",
    success: function (response) {
        if (response) {
            // i want to change url based on response
            //example var next = response.next    
            // den i want to call url as /url/1/next.
        }
    }
});
$.ajax({
    url: "/url/1/1",
    dataType : "json"
}).done(function(response) {
    if ('next' in response) {
        document.location.href = '/url/1/' + response.next;
    }
});
 $.ajax(
    {
            url: "/url/1/1",
            dataType : "json",
            success: function(response) 
            {
                    if(response)
                    {
                       // i want to change url based on response
                       //example var next = response.next    
                       // den i want to call url as /url/1/next.
              -----------------after response----------    
                var next = response.next
                    $.ajax(
                       {
                           url: "/url/1/"+next,// you can set like this
                          dataType : "json",
                        success: function(response) 
                            {.....
                       }
                        });
                 -------------------------------------
                    }
            }
     });