Click here to Skip to main content
15,910,980 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
JavaScript
Ext.application({
        launch: function () {
		
		
	var divToBeWorkedOn = '#AjaxPlaceHolder';
    var webMethod = 'http://184.106.159.143:8080/FirstGroupRailApps/services/RailAppsCAWS/getDestinationStationDashboard'
    var parameters = "{'crsCode':'" + AAP + "'}"

    $.ajax({
        type: "GET",
        url: webMethod,
        data: parameters,
        contentType: "application/xml; charset=utf-8",
        dataType: "xml",
        success: function(msg) {   
alert(msg)		
            $(divToBeWorkedOn).html(msg.d);
        },
        error: function(e){
            $(divToBeWorkedOn).html("Unavailable");              
        }
    });
}

error :Uncaught ReferenceError: AAP is not defined

I am passing parameter to get result.

Where i am wrong?
Posted
v3
Comments
[no name] 21-Sep-12 7:48am    
And where did you define that variable?
_Amy 21-Sep-12 7:49am    
Where is definition for AAP in your code?
ravi1989h 21-Sep-12 7:50am    
var parameters = "{'crsCode':'" + AAP + "'}"
ravi1989h 21-Sep-12 7:51am    
actually AAP is the parameter
_Amy 21-Sep-12 7:52am    
Try this:
var parameters = "{'crsCode':'AAP'}";

1 solution

AAP is a variable here. If you want to pass this value, put it in the quotes. '" + AAP + "'... means you expect AAP to be a variable.
 
Share this answer
 
Comments
ravi1989h 21-Sep-12 19:51pm    
yes you are right...but using your solution i am not getting response .
can you please check this url
http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/why-it-goes-to-if-condiation/m-p/1911581#M29196
i am calling same web service different way so i am not able to call...

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="sencha-touch-all.js" type="text/javascript"></script>

<link href="sencha-touch.css" rel="stylesheet" type="text/css" />
<script>
console.log('Hi');
Ext.application({
launch: function () {
console.log("Hi");

//var type = "test&data";
var divToBeWorkedOn = '#AjaxPlaceHolder';
var webMethod = 'http://184.106.159.143:8080/FirstGroupRailApps/services/RailAppsCAWS?wsdl/getDestinationStationDashboard'

var parameters = '" + AAP + "';
$.ajax({
type: "POST",
url: webMethod,
data: parameters,
contentType: "application/XML; charset=utf-8",
dataType: "XML",
success: function(msg,xml) {
alert("Hi")
var responseXML = xml.documentElement;
alert(responseXML);
alert(msg.stationName);
$(divToBeWorkedOn).html(msg.d);
},
error: function(e){
alert("p")
alert(e);
console.log(e);
$(divToBeWorkedOn).html("Unavailable");
}
});
}
});

</script>

</head>
<body></body>
</html>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900