Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12452 closed bug (invalid)

dataType can not be jsonp, but script is OK.

Reported by: byronsongcn@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

Description

html page:

<html>

<head>

<title>jQuery Tutorial 1</title> <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript">

function processData(data) {

$('#msg').html(data.msg); $('#msg').fadeIn(); setTimeout(function(){

$('#msg').fadeOut(); $('#btn').attr('disabled', false);

}, 3000);

}

function showMsg(e) {

$(e.target).attr('disabled', true); $.ajax({

url: 'msg.php', dataType: 'jsonp', jsonp: 'processData', data: {gender: $('#gender').val(), name: $('#name').val(), callback: 'processData'}, error: function(xhr) {

alert('Ajax request is failed'); $(e.target).attr('disabled', false);

} });

}

$(document).ready(function(){

$('#btn').click(showMsg);

});

</script>

</head> <body>

<div id="msg" style="display:none"></div> <div id="param"> <select id="gender">

<option>Male</option> <option>Female</option>

</select> <input type="text" id="name"/> </div>

<input type="button" value="Click Me" id="btn"/>

</body>

</html>

msg.php: <?php

$res = "Hello, ";

if (!strcmp($_GETgender?, "Male")) {

$res .= "Mr. ";

} else {

$res .= "Miss ";

}

$res .= $_GETname?;

echo $_GETcallback?."({success: 'true', msg: '$res'});";

?>

ERROR:

function ajaxConvert( s, response ) {

...

} s.dataTypes: [text,script,json] when current="json" The error happen: jQuery18006868716098899454_1346731452869 was not called Error!

debug into "response = conv( response );"

conv function() {

if ( !responseContainer ) {

jQuery.error( callbackName + " was not called" );

} return responseContainer[ 0 ];

}

I have got this watch info: responseContainer = undefined.

Change History (1)

comment:1 Changed 7 years ago by timmywil

Resolution: invalid
Status: newclosed

Please ask for help on the forums

Note: See TracTickets for help on using tickets.