Skip to main content

Bug Tracker

Side navigation

#12452 closed bug (invalid)

Opened September 04, 2012 04:35AM UTC

Closed September 04, 2012 02:52PM UTC

dataType can not be jsonp, but script is OK.

Reported by: byronsongcn@gmail.com 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($_GET['gender'], "Male")) {

$res .= "Mr. ";

} else {

$res .= "Miss ";

}

$res .= $_GET['name'];

echo $_GET['callback']."({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.

Attachments (0)
Change History (1)

Changed September 04, 2012 02:52PM UTC by timmywil comment:1

resolution: → invalid
status: newclosed

Please ask for help on the forums