0

I have this route in an API controller called Recruiting:

 ResponseType(typeof (int))]
 [Route("Recruiting/setprimary/")]
 public async Task<IHttpActionResult> PutUpdatePrimary(string userId, string orgId)
 {
     return Ok();
 }

I am trying to hit this routing via ajax like so:

 self.updatePrimary = function () {
    var orgKey = self.selectedOrgKey();
    alert(orgKey);
    $.ajax({
        type: "PUT",
        contentType: "application/json; charset=utf-8",
        url: "/Recruiting/setprimary/" + "?userId=" + userId + "&?orgId=" + orgKey,
        data: null,
        dataType: "json",
        success: function (data) {
            bootbox.alert('Changes saved successfully.');
        },
        error: function (err) {
            bootbox.alert('An error occured while trying to set primary organisation. Please try again :/');
        }
    });
    return true;
};

Fiddler is saying it cannot find the route. What do I have wrong here?

1
  • When you watch the network traffic in your developer tools what is the full URI when you try to hit that action? Commented Jan 29, 2014 at 1:02

1 Answer 1

5

Looks like you have a typo in your request url: Instead of "&?orgId="..it should be "&orgId="

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.