What I would like to do is use $.get to pull data in from another source. With the now returend items in the varible "data" I want to access a node and stick in some of my own html inside it. After doing so, I would like to store the now "completed" data in a varible that can be displayed on screen.
$.get("view/contractCreator.html", function(puzzel){
$.get("controller/controller.php", { command: "contractCreatorDisplay"},function(data){
var contents = "";
data = jQuery.parseJSON(data);
var contractTypeLen = data.length;
for(var i = 0; i < contractTypeLen; i++){
contents += "<div class='actionBox' data-contractType='"+data[i].room_type_id+"' style='width:300px;height:350px;background-color:rgba(101, 201, 168, 0.9);'>";
contents += "<div class='actionBox' data-input='title' data-placeholder='title' style='width:300px;height:50px;background-color:rgba(82,131,158,0.9); clear:both;'><input type='text' id='title' class='inputFill' placeholder='title' value='"+data[i].room_type_name+"'></div>";
contents += "<div class='actionBox' data-input='description' data-placeholder='desciption' style='width:300px;height:110px;background-color:rgba(74,150,129,0.9); clear:both;'><input type='text' id='description' class='inputFill' placeholder='title' value='"+data[i].room_type_desc+"'></div>";
var contractsLen = data[i].rent_contracts.length;
for(var x = 0; x < contractsLen; x++){
contents += "<div class='actionBox' data-contract_id='"+data[i].rent_contracts[x].rent_contract_id+"' data-pdfId='"+data[i].rent_contracts[x].pdf_id+"' data-duration='"+data[i].rent_contracts[x].rent_contract_duration+"' data-deposit='"+data[i].rent_contracts[x].rent_contract_deposit+"' data-rent='"+data[i].rent_contracts[x].rent_contract_rent+"' style='width:149px;height:94px;background-color:rgba(82,131,158,0.9);border-right: 1px solid rgba(150,229,210,0.9);border-bottom: 1px solid rgba(150,229,210,0.9);'><img src='img/addWhite.png' style='height:40px;margin-top:15px;'/><p style='margin-top:10px;font-size:12px;color:white;'>not done</p></div>";
}
contents += "</div>";
}
var completePuzzel = $(puzzel).$('#contractArea').html(contents);
console.log(completePuzzel);
transition(completePuzzel);
});
});
This line is where I would like to insert data I get from another source.
var completePuzzel = $(puzzel).$('#contractArea').html(contents);
Any help would be fantastic and appreciated!