Reputation: 1
How to pass string argument to javascript method
my code
function paginatePage(getPath) {
alert("from pagenate page");
alert("home path initial " + getPath);
}
unable to get the alert message
when i called the method
[NSString stringWithFormat:@"paginatePage(%s)",getPath]
Upvotes: 0
Views: 964
Reputation: 14906
You possibly need to qualify the string with quotes.
I don't know what that NSString syntax is, but something like:
[NSString stringWithFormat:@"paginatePage('%s')",getPath]
Upvotes: 1
Reputation: 262504
Probably just the quotes around the string literal missing?
[NSString stringWithFormat:@"paginatePage('%s')",getPath]
Upvotes: 3
Reputation: 2599
Your error does not come from this, because the code is 100% valid : this is how you pass a string argument to a function.
If you could provide some more code, maybe we could help you.
Also, make sure no other function has the same name, or maybe it's how you called the function?
Upvotes: 0