HTML5 for ASP.NET Developers: Listing 2.

Using the postMessage method for data retrieval.

window.addEventListener(
  "message",
  retrieveData, 
  false
);

function retrieveData (msg) 
{
  if (msg.origin == "http://localsite.com") 
  {
    var custData;
    $.getJSON(
      "Customers/" + msg.data,
      function (data) 
      {
        msg.source.postMessage(data, msg.origin);
      }
    );
  }
}

About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at http://blog.learningtree.com/tag/ui/.

comments powered by Disqus

Featured

  • Copilot Workspace Does Web App in Minutes, No Coding Required

    Here's a taste of our no-coding future, thanks to Copilot AI.

  • Microsoft Previews Mads Kristensen Keynote at Orlando Dev Conference

    Microsoft today previewed a keynote presentation by Visual Studio guru Mads Kristensen at an upcoming developer/IT pro event where he will be joined by other company dev luminaries such as Jon Galloway, Rachel Kang, and James Montemagno.

  • Syncfusion Open Sources 14 Controls for .NET MAUI

    Third-party .NET-centric dev UI tooling specialist Syncfusion this week announced the open sourcing of 14 controls for .NET MAUI, the evolution of Xamarin.Forms that adds support for building desktop apps.

  • Kubernetes for Developers

    "Kubernetes has a lot of 'moving parts' so can be intimidating at first," says Dan Wahlin, a principal cloud developer advocate at Microsoft who promises to explain everything at a developer conference next month in Orlando.

Subscribe on YouTube