javascript - How does one post nested JSON using JQuery? -


I have an admin page for such a store where the user can modify item data. I'm trying to implement something for the administrator so that the images can be dragged by dragging and dragging them one by one. Click

$ ("# saveButton"). ("Form", "true" (); FormData ["item": "(selected)"). Val (); form data ["action"] = "save"; form data ["images"] = {}; $ ("#other image image") (Function (i) {formData ["images"] [I] = $ (this) .attr ("src");}); $ .aex ({type: "post", url: "adminajax.php ", Data: formData});}); Here, the "picture" value is submitted as "[object object]" here.

I have to be an associative array on the "picture" server.

There are just several image keys in one functioning: "image1: source", "image2: source" etc. However, it would be really good if it could be an object so that I can filter key strings Instead of "images" for each

Read the documentation at this option $ .jax request:

If the value is an array, then sorting multiple values ​​with the same key of jQuery {foo: ["bar1", "bar2"]} & amp; Foo = bar1 & amp; Foo = bar2 '

Your example can be written as:

  formData ['images'] = $ .map ($ ("#other image IMG"), Function (i) {return $ (i) .attr ("src");});  

Or, if you are using PHP, you must do this as an assignment instead:

  formData ['images]]]] ]] = ...;  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -