Here is how POST data should be formatted:
key1=value1&key2=value2&key3=value3
In your case (note the & as a separator):
'code=' + code + '&userid=' + userid
But jQuery does that for you if you specify your data as an object:
data: { code: code, userid: userid }