0
var edit = $('#edit .fr').html();

I am sending this value to spring controller using AJAX .

ajaxRequest('POST', 
            JSON.stringify(data), 
            'application/json; charset=utf-8', 
            makeURL('submit') +
                    '?edit' +
                    edit,
            okFunc, 
            errorFunc);

Now in my spring controller, I get the value of edit as null.

@RequestParam(value="edit", required=false)String  edit

Any help would be appreciated.

3
  • Try to change: '?edit' in '?edit=' Commented Mar 22, 2017 at 12:47
  • thanks nik for the help Commented Mar 22, 2017 at 12:59
  • You are welcome Commented Mar 22, 2017 at 13:05

1 Answer 1

1

Your error could be at the part where you build the URL. Looks like the equal sign is missing:

makeURL('submit') + '?edit=' + edit,
Sign up to request clarification or add additional context in comments.

4 Comments

The url posted is correct for other variables, it is working correctly. The problem is comming with .html()
I believe other variables are being sent in your post body. This is the only variable in the url query string.
Open your chrome in debug mode, and in the console evaluate the value of the expression: "makeURL('submit') + '?edit' + edit". Pick up the result and use POSTMAN or some other tool to test your spring endpoint. Check if it works. I doubt it will because of the missing '='
Thanks, it was a typo mistake

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.