You need to sign in to do that
Don't have an account?
SpaceManSpiff
Visualforce Remoting Exception
I get the following error when trying to access a controller Method from a VisualForce page: Visualforce Remoting Exception: only whitespace content allowed before start tag and not C (position: START_DOCUMENT seen C... @1:1)
Here is the Controller Class:
@RemoteAction global static String saveUser(Credentials__c cred, Contact con) { cred.Lead_Number__c = integer.valueof(cred.Lead_Number__c); Http h = new Http(); /* Initialize endpoint URL here Code not included but works */ HttpRequest req = new HttpRequest(); req.setEndpoint(url); req.setMethod('GET'); HttpResponse res = h.send(req); Dom.Document doc = res.getBodyDocument(); DOM.XMLNode root = doc.getRootElement(); //Parses returned XML to String String result = Global_Methods.walkThrough(root); return (result.length()>0 ? result:'Error'); }
And here is my call from the VisualForce Page:
Global_Methods.saveUser(rec,con, function(result, event){ var res = result.split(",",2); res[0] = parseInt(res[0]); if(res[0]!=1){ alert(res[1]); deleteId(record.Id); return false; } else { RegisterTrial(con,rec,subProducts,type); } }, {escape:true});
The odd thing is that this works fine from a different VF page. I have no idea what this error means or how to fix it. Any insight is very much apprechiated. Thanks!
It looks like an XML parsing error. I'd log the user and HTTP response to see what's going on.
Note: This isn't a VF remoting issue as the title suggests.
All Answers
It looks like an XML parsing error. I'd log the user and HTTP response to see what's going on.
Note: This isn't a VF remoting issue as the title suggests.
Yes, you were right. There was a type error in the URL call. I was confused by the error it threw. Thank you very much!