0
私はJavaでJSONを使用してソースコードを送信するには?
//server end
response.setContentType("application/json");
JSONObject jsonCode = new JSONObject();
json.put("code", code); //this have a C/C++ code
json.put("success", true);
//client end
function getCode(pointer)
{
var id = pointer.data.id;
var json = { "id" : id };
$.ajax({
"url" : "getCode",
"data" : json,
"type" : "POST",
"success" : function(data)
{
alert(data.success); //undefined why ?
console.log(data);
if (!data.success) {
alert('code cannot be fetched');
}
}
,
"error" : function(xhr, status, error)
{
console.log('error');
console.log(xhr.responseText); //this is giving me the JSON ??
editor.setValue(xhr.responseText);
}
JSONオブジェクトを使用してサーブレットからC/C++コードを送信しようとしているしかし、その代わりに、成功に対する機能の、誤差関数が呼び出さなっていますか?
編集を私を助けてください:これは私が
enter code here
{"code":#include<iostream>
class bbb{
bbb(int array[12][12]=NULL){
}
};
class aaa{
};
int func(int=12,int=123);
int func(int x,int y){
std::cout<<x<<y<<std::endl;
}
int main()
{
int array[12];
int x=12;
func(13);
if(1==x){
}
//add your code here
return 0;
}
,"success":true}
を送信しようとしているサンプルJSONで今私はそれをテストするためにRestManをも使用している、とのコードがあるときにJSONが壊れますかのように表示されます誰か助けてもらえますか?
が鳴ります。データが「HTTP 200」で返されていることを確認してください。 – jlaitio
あなたはあなたのログを投稿できますか? –
ステータスが –