-
Notifications
You must be signed in to change notification settings - Fork 101
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
$.fetch data stringification is too simple #128
Comments
would you be willing to start writing some tests for |
sad to say, but i've never do any tests and xhr tests sounds like more trouble than to test a simple function :( |
Yeah, currently it does very simple serialization, it's not intended for nested objects. Is this useful/common? If so, I can look into adding it. If not, what jQuery does is not relevant. We’re not trying to emulate jQuery here. |
For me it's extremely useful. Imagine something simple as: Fav colors:
<select multiple name=colors>
<option>green</option>
<option>red</option>
<option>blue</option>
</select> Then I select two items, for server side code it would be totally weird not to receive an array here, but comma separated values. What if I want to have comma separated value in my select? If simple example doesn't convince you: Imagine a web application where I'd like to create an invoice. Well, I have one, and while I'm rewritting some parts of UI - I'm implementing Bliss. [Some "single" stuff, like receiver name, VAT ID, date of issue etc]
Stuff I sold:
<button>[+] add item</button>
<div class=item>
<button>[-] remove</button>
<input name="item[][name]" value="something i sold" />
<input name="item[][price]" value="1337" />
<input name="item[][amount]" value="5" />
</div>
<div class=item>
<button>[-] remove</button>
<input name="item[][name]" value="something else" />
<input name="item[][price]" value="10" />
<input name="item[][amount]" value="1.5" />
</div> I've already done the parsing of names like But sending nested objects data is a must-have for me. Without this (And yes, I can just pack it up into a single JSON and unpack it on the server, but why we are having multiple form items if not for sending multiple values separately? Also if I'd like to use some external API, where I cannot modify server-side code - I'd not be able to use Bliss do communicate with API) |
It would be nice to move the serialization part away from |
Now that we have hooks (see c8ede04 ), I’m thinking about removing the object functionality altogether and just adding a hook there so that people can handle |
Sounds great to me! We don't wanna be gigantic-we-do-it-all library. :) |
polyfills and user customization for the win, this ain't JQuery |
results in server getting weird string:
and
causes comma separated values:
jQuery results (from
$.get
, same params syntax) are as expected:and:
The text was updated successfully, but these errors were encountered: