English 中文(简体)
[J RequestRY][PHP] AJAX request Return OK but it to mis
原标题:[JQUERY][PHP] AJAX request returns OK but it goes to error
  • 时间:2012-04-25 09:43:09
  •  标签:
  • php
  • jquery

I m 试图提出联合请求,PHP与一些奇怪的结果沟通

页: 1

$.ajax({
 type : "GET",
 url : "background.php",
 dataType:  json ,
 success : function(response){
  alert("OK: " + immagini);
 },
 error: function(xhr, ajaxOptions, thrownError){
  eval( var immagini = xhr.responseText );
  alert("CODE: " + xhr.status);
  alert("ERROR: " + immagini + "


TIPO: " + typeof immagini);
 }
}); 

这里指的是PHP。

<?php
 include "amministrazione/config.php";
 include "amministrazione/database.php";
 header("Content-type: application/json");
 $db = new DB($db_server,$db_name,$db_user,$db_pass);
 echo $db->loadBackgroundImages();
?>

最后,我用购买力平价的功能来回答问题。

{ immagini :[{ image :  gallery/alto.jpg },{ image :  gallery/esterno.jpg },{ image :  gallery/gelateria.jpg },{ image :  gallery/vitelli.jpg }]};

奇怪的是,即使法典为200条,吉克里还是以错误手法告终。 我如何确定这一点?

这难道不应该是一个交叉问题,因为这些问题属于关于简便的目录,或者我错了吗?

许多感谢,

Tiwiz

最佳回答

change single quote to double quote in your json

{"immagini":[{"image": "gallery/alto.jpg"},{"image": "gallery/esterno.jpg"},{"image": "gallery/gelateria.jpg"},{"image": "gallery/vitelli.jpg"}]}
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签