diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala index 7044e8f..1d29cf6 100644 --- a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala +++ b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala @@ -129,17 +129,23 @@ trait JQueryStatic extends js.Object { * See: jQuery Docs */ def isXMLDoc[T](el: js.Any): Boolean = js.native + /** Create a serialized representation of an array, a plain object, or a jQuery object suitable + * for use in a URL query string or Ajax request. In case a jQuery object is passed, it should + * contain input elements with name/value properties.
+ * See: jQuery Docs */ + def param(obj: js.Array[js.Any] | js.Object | JQuery, traditional: Boolean = js.native): String = js.native + /** Parses a string into an array of DOM nodes.
- * See: jQuery Docs */ + * See: jQuery Docs */ def parseHTML(data: String, context: Element = js.native, keepScripts: Boolean = js.native): js.Array[Element] = js.native /** Takes a well-formed JSON string and returns the resulting JavaScript value.
- * See: jQuery Docs */ + * See: jQuery Docs */ @deprecated("Since all the browsers supported by jQuery 3.0 support the native JSON.parse() method, we are deprecating jQuery.parseJSON().", "1.1.0") def parseJSON(json: String): js.Any = js.native /** Parses a string into an XML document.
- * See: jQuery Docs */ + * See: jQuery Docs */ def parseXML(xml: String): js.Dynamic = js.native /** Load data from the server using a HTTP POST request.
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala index c2630c7..95b3953 100644 --- a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala +++ b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala @@ -43,6 +43,11 @@ class MiscellaneousTest extends WordSpec with Matchers { selection.index(jQ(el3)) should be(2) selection.index(el4) should be(-1) } + + "serialize objects to URL query string" in { + import scala.scalajs.js, js.JSConverters._ + jQ.param(js.Dynamic.literal("a" -> Seq(1, 2, 3).toJSArray, "b" -> "c")) should be("a%5B%5D=1&a%5B%5D=2&a%5B%5D=3&b=c") + } } }