Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Retrieve individual licence information.
- function loadLicenceDetails(uniqueID) {
- document.body.style.cursor = 'wait';
- $('#loadingLicenceDiv').modal('show');
- $.ajax({
- type: 'POST',
- contentType: 'application/json; charset=utf-8',
- url: '/JadeLicensingWebService/default.asmx/GetLicenceDetails',
- dataType: 'json',
- data: '{"licenceHolder":"' + $.cookie("companyName") + '","uniqueID":"' + uniqueID + '"}',
- success: function (data) {
- resp = $.parseJSON(data.d);
- $('#inputLicenceName').val(resp[0].LicenceName);
- $('#licenceKeyInput').val(resp[0].LicenceKey);
- $('#selectProductType').val(resp[0].Product);
- $('#selectDuration').val(resp[0].Duration);
- $('#startDateInput').val(resp[0].StartDate);
- $('#expiryDateInput').val(resp[0].ExpiryDate);
- $('#orderedByInput').val(resp[0].OrderedBy);
- // How do I get at the History.UniqueID ?
- $('#notesInput').val(resp[0].Notes);
- $('#licenceInfoHeader').html('<strong>#' + uniqueID + '</strong> - ' + resp[0].LicenceName);
- {
- "History": [
- {
- "UniqueId": "abc"
- },
- {
- "UniqueId": "def"
- },
- {
- "UniqueId": "ghi"
- },
- ]
- }
- var ids = []; // Make an array to hold the IDs
- // Iterate over History items
- for (var i = 0; i < resp.History.length; i++) {
- var item = resp.History[i];
- ids.push(item.UniqueId); // Put each ID in the array
- }
- $('#licenceHistoryText').val(resp[0].History[0].DateIssued);
- $.each(resp[0].History, function (i, obj) {
- document.getElementById("licenceHistoryText").value += obj.DateIssued + ' - ' + obj.LicenceName + ' [' + obj.LicenceKey + ']n';
- });
- let jsonString = "{"stat" : "ok","blogs" : {"blog" : [{"needspassword" : true,"id" : 71,"name" : "Bloxus test","url" : "http:remote.bloxus.com","blog" : [{"needspassword" : true,"id" : 72,"name" : "Bloxus test","url" : "http:remote.bloxus.com","blog" : [{"needspassword" : true,"id" : 73,"name" : "Bloxus test","url" : "http:remote.bloxus.com","blog" : null}]}]},{"id" : 74,"name" : "Manila Test","needspassword" : false,"url" : "http:flickrtest1.userland.com","blog" : null}]}}"
- var error : NSError?
- let JSONData = jsonString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
- let json: AnyObject = NSJSONSerialization.JSONObjectWithData(JSONData!, options: nil, error: &error) as NSDictionary
- var blogs = json["blogs"] as NSDictionary;
- var globeArr: NSMutableArray = []
- func parseBlog(blog: NSArray) {
- for ar in blog as [NSDictionary] {
- globeArr.addObject(ar)
- if ar["blog"] is NSArray {
- parseBlog(ar["blog"] as NSArray)
- }
- }
- }
- parseBlog(blogs["blog"] as NSArray)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement