Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Cort Larsen 388 posts 922 karma points
    Apr 23, 2012 @ 09:58
    Peter Cort Larsen
    0

    js crossbrowser call to js which invoke umbraco base call

    I need a little help and guidance.
    I need to be able to make a call from js (much like the Google Analytics code which you embed in your html).
    This code calls a remote js fril (On a different server).
    I use this code for taht part.
    <script type="text/javascript">
      var demo = demo || [];
      demo.push(['myfunc'], ['12345']);
      demo.push(['func2'], ['hello']);
      (function()
      {
        var myscript = document.createElement('script');
        myscript.src = 'http://umb_4.7.1.1.com/scripts/async.js';
        myscript.setAttribute('async', 'true');
        document.documentElement.firstChild.appendChild(myscript);
      })();
    </script>


    But in the async.js fil i need to do a /base call (or mayby create a WS).
    Which returns a member property.
     [RestExtension("Test")]
        public class Test
        {
            [RestExtensionMethod()]
            public static string IsAuthenticated(string MemberName) {

                Member m = Member.GetMemberFromLoginName(MemberName);

                if (m.getProperty("isAuthenticated").Value.ToString() == "1")
                {
                    return "true";
                }
                else
                {
                    return "false";
                }
         
            }
        }

    My problem is that i need to make a bridge between the base call and async.js.
    I need to call base, get the returning value and send the value to the remote client.

    I can make a simple html page which gets the value from the base call, but this dosnt work , when i call it from the remote client.

    So what do i do???

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies