でAJAXを使用して2次元配列形式の入力を提出:は、次のように私は、フォームを持っているのJavascript
<form name="chat" id="chat" action="" onsubmit="sendMessage()">
<a name="chat"> </a>
<input type="text" name="chat" id="chat" size="38" maxlength="50" vertical-align="middle">
<input type="hidden" name="action" id="action" value="checkresponse">
<input type="hidden" name="response_Array[sessionid]" id="response_Array[sessionid]" value="keu88lh88ini89dgnccob54f27"><br>
<input type="text" name="response_Array[top]" id="response_Array[top]" value="a">
<input type="text" name="response_Array[second]" id="response_Array[second]" value="b"><br>
<input type="text" name="response_Array[third]" id="response_Array[third]" value="c"><br>
<input type="text" name="response_Array[fourth]" id="response_Array[fourth]" value="d"><br>
<input type="text" name="response_Array[input][0]" id="response_Array[input][0]" value="input 0"><br>
<input type="text" name="response_Array[that][0]" id="response_Array[that][0]" value="that 0"><br>
<input type="submit" name="submit" id ="submit" value="SEND" style="width: 45px">
</form>
ユーザーがクリックを提出すると、私は、サーバーへのすべての入力フィールドを送信する必要があります。 しかし、ページがリフレッシュされるべきではありません。したがって、私はsendMessage()を作成しました。ここでは、XMLHttpRequestオブジェクトを使用してフォーム送信リクエストを送信しています。
入力フィールドを読み取るために、私は(のsendMessageで使用している):
var infoStr = "chat="+document.forms[0]['chat'].value;
infoStr += "&action="+document.forms[0]['action'].value;
私は2次元配列読むべき方法を知りたい:response_Arrayをし、それが通過することができるようにJSON文字列にそれを解析phpサーバコードに渡します。
jQueryとその '.json'メソッドを使用するだけではどうですか? –