Can anyone explain the following. I’ve been looking for a network for ages, trying to find help, and I believe that I’m doing everything right, but still get errors.
I have the following script on my page:
function GetPageAdvert2(url) { $.getJSON('http://url/servicename.asmx/CheckAdvert?callback=?', { pagename: url, success: function(data) { alert(data) } }); };
And my web service does not return anything:
jsonp1301065851157('url/KiN_150x300.jpg');
The problem is that when I call GetPageAdvert2 nothing happens.
My WebService (written in VB.Net):
<WebMethod()> _ <ScriptMethod(ResponseFormat:=ResponseFormat.Json, XmlSerializeString:=False, UseHttpGet:=True)> _ Public Sub CheckAdvert(ByVal pagename As String, ByVal callback As String) Dim pageUID As Integer = 0 Dim advertURL As List(Of aU) = New List(Of aU)() Dim sss As String Using con As New System.Data.SqlClient.SqlConnection(My.Settings.sqlConnection2) SQL STUFF IN HERE the SELECT statement will return a value and place it in Variable SSS End Using Context.Response.ContentType = "application/json" Context.Response.Write(callback & "('" & sss & "');") Context.Response.End() End Function
The answer I get (in FF) is this:
PARAMS: callback jsonp1300979718942 contentType application/json; charset=utf-8 pagename default.html success undefined RESPONSE: jsonp1301065851157('url/KiN_150x300.jpg');
This is basically what I think is right.
However, "Warning (data)" produces nothing but "undefined".
source share