{"id":321,"date":"2012-01-09T20:31:29","date_gmt":"2012-01-10T01:31:29","guid":{"rendered":"http:\/\/www.cloppermillweather.org\/blog\/?p=321"},"modified":"2012-01-09T20:31:29","modified_gmt":"2012-01-10T01:31:29","slug":"its-a-knockout","status":"publish","type":"post","link":"https:\/\/www.cloppermillweather.org\/blog\/2012\/01\/09\/its-a-knockout\/","title":{"rendered":"It&#8217;s a Knockout"},"content":{"rendered":"<p>I&#8217;ve spent some more time working with the JavaScript side of the Web recently.\u00a0 I updated my PHP classes to serialize themselves to JSON.\u00a0 Then I added Web pages to return that data.\u00a0 This allows me to easily transfer that data to the client browser and convert ti to JavaScript.\u00a0 That seems to be working really well.\u00a0 That also gave me an opportunity to try out jQuery for retrieving the data using Ajax.\u00a0 jQuery is really overkill for what I use it for, as I only use it to make the Ajax calls, and it can do so much more.\u00a0 I found an add-in for jQuery that adds timer functionality.\u00a0 I had started working on creating a timer with multiple observers that could be triggered at different intervals.\u00a0 But this jQuery plug-in already does what I planned to build.\u00a0 So I&#8217;m giving it a go as well.<\/p>\n<p>So now that I can get the data transferred in a format that&#8217;s easy to work with, and can transfer to according to a schedule based on the different types of data, I needed to display it.\u00a0 That&#8217;s where Knockout comes into the picture.\u00a0 Knockout allows me to define fields in an HTML document and bind them to the data that I retrieve using jQuery.\u00a0 As part of the data binding process I can define formatting for the data when it&#8217;s displayed.\u00a0 So now I have a clearly defined separation of the data and the rules for formatting the data.\u00a0 Although both jQuery and Knockout have way more functionality than I need or plan to use, I think I&#8217;m going to like working with them.\u00a0 I just need to make sure I don&#8217;t get carried away trying to find ways to use the other features.\u00a0 That is the danger of using products like these.\u00a0 I end up looking for a problem to fit the solution I already have.<\/p>\n<p>I&#8217;ve done a fair bit of prototyping using these products in my development environment.\u00a0 First it took me a while to get used to the way Knockout\u00a0 and jQuery work.\u00a0 Once I got the basics working, I started looking at scheduling the Ajax calls from the client to the server.\u00a0 Finally, I experimented with ways to format the data for display on the Web pages.\u00a0 I feel like I have all of those items working, as well as a plan on how best to integrate this into my existing Web pages.\u00a0 I still have a lot of work to complete, as well as testing.\u00a0 The sad part is that the Web pages will probably look exactly the same after I finish the conversion.\u00a0 But I learned some new techniques, the design is better from a purist point of view, and the site will hopefully be easier to maintain..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent some more time working with the JavaScript side of the Web recently.\u00a0 I updated my PHP classes to serialize themselves to JSON.\u00a0 Then I added Web pages to return that data.\u00a0 This allows me to easily transfer that &hellip; <a href=\"https:\/\/www.cloppermillweather.org\/blog\/2012\/01\/09\/its-a-knockout\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-321","post","type-post","status-publish","format-standard","hentry","category-weather"],"_links":{"self":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/comments?post=321"}],"version-history":[{"count":0,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts\/321\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/media?parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/categories?post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/tags?post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}