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:33
    Mitra
    0

    Ajax calls not working with 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);
                }
            });
        } 
    
  • 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