user2541457
user2541457

Reputation: 81

call a javascript function from an ios application

Advanced thank you for the answers. I have a iOS uibutton function

- (IBAction)sendVIN:(id)sender
{}

When i click this button the ReceiveVin javascript function has to be called and vin number variable has to be passed as parameters to that function present inside the webpage.

     <script>
        function ReceiveVin(vin)
        {
            document.getElementById('vinnumber').value = vin;

        }
</script>

This is an online website an can be found at this link "http://tk14.webng.com/autofunds.html"

I cannot use webview for this functionality.

Upvotes: 0

Views: 67

Answers (1)

rakeshNS
rakeshNS

Reputation: 4257

You can use UIWebView's - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script method. An example

[webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('vinnumber').value = vin"];

Upvotes: 1

Related Questions