vb.net - JavaScript 500 internal server error -
i have code when executed nothing. on chrome debugger see shows failed load resource: server responded status of 500 (internal server error)
string fine http://abc-wsdl.company.net/mobile.asmx/contactget?searchfield=rua&office=97&person=119&user=531&organization=14
if click on it shows right data:
<string xmlns="http://company.net/"> [{"name":"ruan","surname":"beneke","mobile":"0831231234","email":"ruan.beneke@company.gov.za"}] </string>
i have looked @ function , look's fine, have tried always : successcontact, done : successcontact
.
my javascript function:
function contactview() { alert("1") var txtsearchbox = $("#searchtextfield").val(); $.ajax({ type: "get", data: param = "searchfield="+txtsearchbox+"&office="+localstorage.getitem("office")+"&person="+localstorage.getitem("person")+"&user="+localstorage.getitem("user")+"&organization="+localstorage.getitem("organization"), contenttype: "application/json; charset=utf-8", url: "http://abc-wsdl.company.net/mobile.asmx/contactget", datatype: "json", crossdomain: true, success: successcontact, error: function (msg) { console.log(msg) } }); alert("2") }
it not call successcontact goes error. or not error nothing , chrome debugger shows message mentioned above.
my webservice code:
<webmethod()> _ <scriptmethod(responseformat:=responseformat.json, usehttpget:=true)> _ public function contactget(byval searchfield string, byval office string, byval person string, byval user string, byval organization string) string dim objsearch new arraylist dim objsearching new search dim intresult integer try 'test string intresult = objsearching.searchbykeyword(searchfield, person, office, organization, user, company.etmyproperty.search.enmsearchtype.enmcontact, objsearch) dim objcontact new person dim dt new datatable("contacts") dim col_name new datacolumn("name", gettype(string)) dt.columns.add(col_name) dim col_mobile new datacolumn("surname", gettype(string)) dt.columns.add(col_mobile) dim col_office new datacolumn("mobile", gettype(string)) dt.columns.add(col_office) dim col_category new datacolumn("email", gettype(string)) dt.columns.add(col_category) dim dr datarow = 0 objsearch.count - 1 dr = dt.newrow() dr("name") = directcast(objsearch(i), company.etmyproperty.search).return2 dr("surname") = directcast(objsearch(i), company.etmyproperty.search).return3 dr("mobile") = directcast(objsearch(i), company.etmyproperty.search).return6 dr("email") = directcast(objsearch(i), company.etmyproperty.search).return7 dt.rows.add(dr) next dim serializer new javascriptserializer() dim rows new list(of dictionary(of string, object))() dim row dictionary(of string, object) = nothing 'serialize dt row json output each drow datarow in dt.rows row = new dictionary(of string, object)() each col datacolumn in dt.columns row.add(col.columnname, dr(col)) next rows.add(row) next dim str_json = jsonconvert.serializeobject(dt, formatting.indented) return str_json catch ex exception return nothing end try end function
i can saw webservice working otherwise wont see data if click in link in debugger. gets query string right.
i have been on 2 day's , cant problem is. ideas ?
look in chrome dev tools or firebug , see being sent server. 500 server error must mean isn't being requested correctly.
also try accessing url without of variables , see happens.
Comments
Post a Comment