نشر صفيف باستخدام jQuery .Post ()
سؤال
لذلك أنا جديد إلى حد ما في تجربة .post () بأكملها () مع jQuery.
لدي فقط تجربة نشر قيم الإدخال فقط حتى الآن.ما أريد القيام به هو نشر صفيف.
وهو مجموعة قياسية لقائمة الأرقام.الهدف النهائي يجري: إجراء استعلام بهذه القيم.
هل يمكن لشخص ما أن يشرح لي بشكل أساسي إلى حد كبير كيفية استخدام JQuery .Post () يمكنني نشر صفيفتي؟
شكرا جزيلا،
المحلول
I guess, without going into great detail, the answer on you question is called JSON
.
The process is easy:
Backend (PHP) Array -> encode as JSON string -> send that JSON string to the browser -> decode the JSON string as Javascript Array
نصائح أخرى
Check jQuery.post(). There is an example for posting arrays.
EDITED: Example is like;
$.post("test.php", { 'choices[]': ["Jon", "Susan"] });
Check The jQuery Site and the Docs for jQuery.post()