0
jsonrpcエンドポイントにデータを送信する請求書作成フォームを作成しています。サーバーはステータスコード200を返しますが、私はこの応答を取得{メッセージ: "エラーを構文解析を無効JSONは、サーバーが受信しました。"、コード:-32700、..} エラー-32700でフォームデータをjsponrpcエンドポイントに投稿する
$(document).on("submit", "#billing", function(event)
{
event.preventDefault();
$.ajax({
url: $(this).attr("action"),
type: $(this).attr("method"),
dataType: "JSON",
data: {new FormData(this)},
processData: false,
contentType: false,
success: function (data, status)
{
console.log('Submission was successful.');
console.log(data);
},
error: function (xhr, desc, err)
{
console.log('An error occurred.');
console.log(data);
}
});
});
<form name="billing" id="billing" action="https://XX.XX.XX.XX/ghe/api2/call/jsonrpc2" method="POST">
First Name: <input type="text" id="firstname" name="firstname"/> <br/>
Surname: <input type="text" id="surname" name="surname" />
<br/>
Email : <input type="text" id="email" name="email"/>
<br/>
<input type="submit" name="submit" value="submit">
</form>
$("#submit").click(function()
{
\t $("#billing").submit(function(e)
\t {
\t \t var postData = $(this).stringify();
\t \t var formURL = $(this).attr("action");
\t \t $.ajax(
\t \t {
\t \t \t url: $form.attr('action'),
\t \t \t type: "POST",
\t \t \t data : postData,
\t \t \t success:function(data, textStatus, jqXHR)
\t \t \t {
\t \t \t \t console.log("success");
\t \t \t },
\t \t \t error: function(jqXHR, textStatus, errorThrown)
\t \t \t {
\t \t \t \t console.log("Failed");
\t \t \t }
\t \t });
\t });
\t \t
\t $("#billing").submit(); //SUBMIT FORM
});
しかし、私はまだその同じエラー解像度を取得しますポンセ。何が間違っているのですか?私の知るように、APIの使用については新しいので、今はちょっと散らかっています。 APIのURL最高の学習リソースを指摘できる場合..あなたは無効なJSON-RPC例外を引き起こしているかを確認するためにサーバーに送信されるペイロードをキャプチャする必要が
おかげ