Copied to clipboard

Flag this post as spam?

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


  • Mitra 81 posts 196 karma points
    Jan 28, 2014 @ 11:27
    Mitra
    0

    Ajax calls not working in umbraco...

    Hello,

    Does anyone know how to call a controller in a view using ajacks? I have got an umbraco project which i call the controllers for it via mvc. It works fine, but when i want to use ajax i get this error: Object not found.... the code it:

    function DoPostcodeLookup(postalCode) { //var postalCode = $('#comppostcodelookup').val(); alert(postalCode); $.ajax({ type: 'GET', url: '@Url.RequestContext.HttpContext.Request.Url.GetLeftPart(UriPartial.Authority)/Employer/GetPostalCodeAddresses', dataType: 'json', cache: false, data: { postalCode: postalCode }, success: function (data) { if (data.Success) { alert("Data has arrived"); $.each(data.Addresses, function () {

                            var currentItem = this.AddressLine1 + ", " + this.AddressLine2 + ", " + this.AddressLine3 + ", " + this.CompanyName + ", " + this.County + ", " + this.Postcode + ", " + this.PostTown;
                            alert(currentItem);
                        });
    
                    } else {
                        alert(data.FailureInformation);
                    }
                },
                error: function (xhr2, status2, error2) {
                    alert(xhr2 + " " + status2 + " " + error2);
                }
            });
        } 
    
  • Zakhar 171 posts 397 karma points
    Jan 28, 2014 @ 12:06
    Zakhar
    1

    Hi Mitra,

    Have you seen this? http://our.umbraco.org/documentation/Reference/WebApi/

    I haven't used it myself and don't know how useful / relevant to your version it is, but may be it's what you are looking for?

    Zakhar

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 28, 2014 @ 12:08
  • Mitra 81 posts 196 karma points
    Jan 31, 2014 @ 11:12
    Mitra
    0

    Thank a lot - We started to use SurfaceController. The articles you sent was very useful.

    Regards, Mitra

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 31, 2014 @ 20:37
    Jeroen Breuer
    0

    Hello,

    Could you please mark a post as the solution if it helped you.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft