This should be an easy one. but its not going well for me.
Just for the heads up, even though i dont believe it has an influence: i am doing this in phonegap.
I’ve created a wcf service that connects my app to the database.
Instead of connecting to the wcf service directly, i’ve made a simple html page that takes the GET parameters from the url, and connects to the database with those values
Alright, i’ve put a test file called ajax_info.html on the site, and my scripts are working fine. But when i put the url above in, it wont do anything. i connected my phone to fiddler, and absolutely nothing happens…
Here’s my script (credits to wc3schools).
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
var user= "something";
var pass= "something";
xmlhttp.open("GET", "http://XX.XX.XXX.XX:8080/wcf/site.html"+"?user="+user+"&pass="+pass,true);
xmlhttp.send();
}
This code is not working at all:
function login(){
$.ajax({
type: "GET",
url: "http://XX.XX.XXX.XX:8080/wcf/site.html",
data: {"user":"something", "pass":"something"},
// processData: true,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg);
},
error: function (msg) {
$.each(msg, function() {
$.each(this, function(k, v) {
alert(v);
});
});
}
});
}
Try this…
Greetings.