Please ignore my post. I can manage it myself. Just change the
property input: to "input[]": and my problem is resolved
Thanks for reading
On Nov 10, 8:36 pm, pcdinh <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have had a problem in making a post to my PHP server in ajax manner.
> My form has a selection box that an user can select multivalue. It
> means that I need to make a post to my server using a parameter that
> accept multivalues.
>
> Here is my code:
>
> $("#submit").click(function() {
> $.ajax({
> type: "POST",
> url: "post_json.php",
> data: {
> message: 'help',
> id: 1,
> year: $('#year').val(),
> input: ['45', '34'] // This line is ok with
> Java but will
> cause PHP confused
> },
>
> dataType: "json",
> success: function(json) {
>
> },
>
> error: function(request) {
> $("div#content").empty().append("There is a
> problem with your
> request: " + request.responseText);
> }
>
> });
> });
>
> The problem is the line input: ['45', '34'] will cause JQuery making
> an URL input=45&input=34, that is valid in Java but not is the case in
> PHP because PHP requires that url must be input[]=45&input[]=34. How
> can I do that in Jquery way?
>
> Thanks