Creating a json with dynamic values
In my code i need to call a web service with a json file as argument.
this.myWebService.call({"UserId" : "1"});
the above line is my webservice call.Here the UserId 's value is dynamic For eg.the userId is 1 or userId is 2 or 3 , etc...How do i 开发者_C百科pass this ID dynamically with a value I get from my program.
Please help.
if it would have php then i would have done
<script type="text/javascript">
var userId = <?php echo $user_id ?>;
this.webService.call("UserId": userId});
</script>
Hope this helps!!!
精彩评论