New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serializeJSON ignoring <select> #45
Comments
You should use the rendered HTML in the example, since serializeJSON only understands about rendered HTML. But it seems like the first I would try to select something else before running $('#myForm select option:eq(2)').prop('selected', true);
var formData = $("#myForm").serializeJSON();
var jsonstring = JSON.stringify(formData); |
Thanks- I tried this on change... $('#PersonJobDescription option').each(function () {
is equal to our value still no go... On Tue, Aug 4, 2015 at 2:57 PM, Mario Izquierdo notifications@github.com
cheers, Glennhttps://www.facebook.com/glenn.devlin |
Please show the actual HTML. And the |
Here's what i did to resolve it: var formData = Basically, I want it to ignore the request verificationtoken, next, by using "select, textarea' it starting scooping up the selected item Next I used JSON.stringify and we are good to go. thanks! Very nice plug in and good job, too! On Wed, Aug 5, 2015 at 3:10 PM, Mario Izquierdo notifications@github.com
cheers, Glennhttps://www.facebook.com/glenn.devlin |
Glad you solved it. |
I'm kind of puzzled - I've created a simple select in MVC as follows:
<%:Html.DropDownList("PersonJobDescription", new SelectListItem[] {
new SelectListItem { Text = null, Value = null },
new SelectListItem { Text = "Administrator", Value = "Administrator" },
new SelectListItem { Text = "Nurse", Value = "Nurse" },
new SelectListItem { Text = "Teacher", Value = "Teacher" },
new SelectListItem { Text = "Secretary", Value = "Secretary" },
new SelectListItem { Text = "Health Aide/UAP", Value = "Health Aide/UAP" },
new SelectListItem { Text = "Other", Value = "Other" }
})%>
The name "PersonJobDescription" is rendered correctly in HTML. However upon using the following:
var formData = $("#myForm").serializeJSON();
var jsonstring = JSON.stringify(formData);
Everything else is scooped up into json nicely but the selector "PersonJobDescription" is ignored even though it has a name property being rendered. I also tinkered with Selected=true which is rendered as Selected="selected" it is still being ignored.
Thoughts?
The text was updated successfully, but these errors were encountered: