Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Sandip,

I found your article on this website regarding Synchronous JavaScript call using Scriptable XML Webservice. I reffer your following code

C#
function HelloMe() {
        var result = GetSynchronousJSONResponse('<%= Page.ResolveUrl("~/WebService.asmx/HelloMe") %>', '{"Name":"' + document.getElementById('txtName').value + '"}');
        result = eval('(' + result + ')');
        alert(result.d);
    }


but I want to pass multiple arguments to Page.ResolveUrl function like Name, City, State.

Please help me

Thanks,
Sandip B. Patel
Posted
Updated 26-Aug-10 21:42pm
v3
Comments
Dalek Dave 27-Aug-10 3:41am    
Minor Edit for Spelling.

Well, I think he is trying to send multiple parameters in JSON format in the GetSynchronousJSONResponse() method, that's all.

If this is the case, then, take a look at below. I've added another parameter (State). You can follow this to add more parameters.

C#
function HelloMe() 
{
           var result = GetSynchronousJSONResponse('<%= Page.ResolveUrl("~/WebService.asmx/HelloMe") %>', '{"Name":"' + document.getElementById('txtName').value + '","State":"' + document.getElementById('txtState').value + '"}');
           result = eval('(' + result + ')');
           alert(result.d);
}


Best of luck.
 
Share this answer
 
v2
Comments
Christian Graus 27-Aug-10 2:45am    
Yeah, that's basically what I was advocating, but I don't know enough about JSON to have known the format for sure ( that it was comma seperated, not, say, semicolon seperated )
Al-Farooque Shubho 27-Aug-10 2:51am    
Yes. I just tried to help him with codes as his problem seems to be specific (How to add more parameters with keeping the syntax correct).
Christian Graus 27-Aug-10 3:41am    
*grin* yeah, I was saying that I was on the right track, but you knew more about it than I did.,
Dalek Dave 27-Aug-10 5:03am    
Good Answer
It's quite unlikely that the article writer will visit this page and see your question.

There is discussion forum below the article. You can put up your question there. The article writer gets notified about the messages there and so you can expect a reply from him (or the other article readers).
 
Share this answer
 
v2
Hi Patel. Some suggestions

1 - try to use a meaningful subject. You think anyone who posts here is NOT requesting help ?
2 - if you're responding to an article, there's a forum under the article
3 - if you're responding to an earlier post, respond to that thread

In both cases, 2 and 3, doing that both keeps things orderly on this site, and sends an email to the person you're trying to talk to.

The most probable answer is you need to concatenate your values and parse them on the other end. If you're passing a URL, you can put as many query string parameters on there as you like. I believe you can do the same for JSON.
 
Share this answer
 

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