Ajax重定向到另一个页面

On clicking submit button , it hits my API and returns a json , which i'm able to post it in same page. But I need the results to get posted under div of another html page. I've a problem with ajax success redirect

$.ajax({
        type: "POST",
        enctype: 'multipart/form-data',
        url: "/upload",
        data: data,
        success: function (data) {

            $("#result").text(data);
            console.log("SUCCESS : ", data);
            $("#btnSubmit").prop("disabled", false); 

        }

This is the code. '/upload' is the API url. on success I need the ajax function to redirect to a page say "sample.html" and post the data variable using a div tag. I'm unable to redirect using window.location.href.

Thanks

var base_url=$('#base_url').val();
//Get base url from a hidden textbox or anyway you prefer   
$.ajax({
      type: "POST",
      url: base_url + "Controller/function/",
      data:{
        data:data
    },
    success: function(data){
    var url=base_url+"Link_to_page_to_be_loaded_on_success";
     $(location).attr('href',url);
  },
 error: function(data){
    var url=base_url+"Link_to_page_to_be_loaded_on_error";
     $(location).attr('href',url);
  }
});