0

I am making a call to a controller from jquery and I am trying to give it parmeters to it. I am having no luck. It works fine without parmeters when the url is just /SurveySection/EditLocalization shouldn't it look like this /SurveySection/EditLocalization?surveySectionId=3?localizationId=dfasdfas

jquery

   LinkAjax.ajaxRequest("/SurveySection/EditLocalization" += "?surveySectionId=" + "3" + "?languageId=" + $localizationList.val(),
                            "random data",
                            "localizationPartial",
                            null,
                            null,
                            localizationSelectList.renderLocalizationPartialView);

This is what my controller looks like

        public PartialViewResult EditLocalization(int surveySectionId, string languageId)
        {
        ... ajax call fails because I can't pass in parameters correctly
        }
2
  • What is LinkAjax.ajaxRequest()? Commented May 23, 2016 at 0:23
  • @Stephen It's a secret! Commented May 23, 2016 at 0:27

1 Answer 1

1

Maybe the url to the controller is wrong. After the base url, the query string parameters are divided by ? and the parameters are divided by &. Try this:

LinkAjax.ajaxRequest("/SurveySection/EditLocalization" += "?surveySectionId=" + "3" + "&languageId=" + $localizationList.val(),
                            "random data",
                            "localizationPartial",
                            null,
                            null,
                            localizationSelectList.renderLocalizationPartialView);
Sign up to request clarification or add additional context in comments.

2 Comments

I should have replaced it with the & symbol, silly mistake. Thanks. You posted it before me lol.
Have to wait 12 minutes before I can check it.

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.