私はこのスクリプトに興味を持ったhttp://www.9lessons.info/2009/06/comment-system-with-jquery-ajax-and-php.html
ajax が を呼び出していることがわかりますcommentajax.php
。
私がやりたいのは、そのphpを無視することです。jsonファイルに投稿してから、同じファイルから応答を取得したいからです。
私のサーバーはデータベースにデータを使用POST
またはPUT
配置するため、phpを使用する必要はありません。構文だけで私は死んでいます:)
使いたい:
$.ajax({
type: "POST",
url: "http://www.xxx.com/json",
data: dataString,
cache: false,
success: function(html){
$("ol#update").append(html);
$("ol#update li:last").fadeIn("slow");
document.getElementById('comment').value='';
$("#name").focus();
$("#flash").hide();
}
});
しかし、その後、どのようにcommentajax.php
見えるでしょうか?おそらくphpを次のように置き換えます:
$.getJSON('http://www.xxx.com/json' , function(data) { ... });
どんなアイデアでも役に立ちます ありがとう。
編集1: i have the server-side script in place