Window.Open - Control it

by patelsan

HTML

<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.1.0.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css">
<button data-bind="click: ChangeOwnership">Change Ownership</button>

CoffeeScript

jQuery ->
  vm = {}
  vm.ChangeOwnership = ->
    console.log 'Clicked'
    chnageOwnerWindow = window.open()
    $(chnageOwnerWindow.document.body).html("<div style='margin-top: 40px;margin-left: 40px;width: 500px;color: #C09853;border-color: #BCE8F1;padding: 8px 35px 8px 14px;border: 1px solid #FAEACA;border-radius: 8px;background-color: #FCF8E3;'><h2>Making Ownership changes for the property. Please wait...</h2></div>")
    
    #Make Ajax call here
    #setTimeout(=> chnageOwnerWindow.location.href = "https://jll2011stage.crm2011stage.joneslanglasalle.com/main.aspx", 
    #4000)
    
  ko.applyBindings(vm)