Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
marwanbatta
Posts: 3
Registered: ‎06-13-2011
My Device: playbook
Accepted Solution

jQuery Mobile web service connection on Playbook

Hello all, I am trying to create an application and utilizing the jQuery mobile technology. 

 

I have created a local webservice and everything works when tested on any of the browsers. However, when deployed on the playbook simulator. It does not work. I simply get an allert that says "error", from the ajax web service call.

 

Here is my code.Any help would be greatly appreciated. 

 

WEBSERVICE

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()>
Public Class LeaseAnalyst
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloMarwan() As String
        Return "Hello Marwan"
    End Function


    <WebMethod()> _
    Public Function calculateFutureValue(ByVal currSavings As String, ByVal periodIntRate As String, ByVal noOfPayments As String, ByVal additonalCont As String) As String
        Return Calculate.CalculateFutureValue(currSavings, periodIntRate, noOfPayments, additonalCont, 0, 0)
    End Function



End Class

 

 

 

 

HTML/ JAVASCRIPT

<script type="text/javascript">

        $(window).load(function () {
            $('form').submit(function (e) {
                e.preventDefault();

                $.ajax({
                    type: "POST",
                    url: "LeaseAnalyst.asmx/calculateFutureValue",
                    data: "{ 'currSavings': '4', 'periodIntRate': '4', 'noOfPayments' : '48', 'additonalCont' : '34' }",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        alert('goodbye');

                        $("#results").append(msg.d);

                    },
                    error: function (request, status, error) {
                        alert('hello');
                        alert(request.statusText);
                    }
                });


            });
        });

    </script>

 

Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: jQuery Mobile web service connection on Playbook

you have Verifies that the direction this in your white list.

 

your it can place the complete direction of the service Web

 

example:

 

http://youhost.com/LeaseAnalyst.asmx/calculateFutureValue

Please use plain text.
New Contributor
marwanbatta
Posts: 3
Registered: ‎06-13-2011
My Device: playbook

Re: jQuery Mobile web service connection on Playbook

[ Edited ]

the webservice is local though, within the same folder.

Your saying to add an <access> element my config file correct?

I don't know which domain I would add. When I test in VS2010, it simply generates a localhost, but because its local, I use relative path instead of absolute. 

 

EDIT: I tested on browsers with "http://localhost:50265/WebServiceCall/LeaseAnalyst.asmx/calculateFutureValue" and that works but not on the simulator, which makes sense because that port is one that VS generated. 

Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: jQuery Mobile web service connection on Playbook

You can configure IIS to always start from the port

Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: jQuery Mobile web service connection on Playbook

try putting the ip of your machine.
example:
http://10.0.0.6:8080/LeaseAnalyst.asmx/calculateFutureValue

Please use plain text.
New Contributor
marwanbatta
Posts: 3
Registered: ‎06-13-2011
My Device: playbook

Re: jQuery Mobile web service connection on Playbook

Thanks this got it working.

Please use plain text.