user727310
user727310

Reputation: 1

How to pass string argument to javascript method

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

Answers (3)

Town
Town

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

Thilo
Thilo

Reputation: 262504

Probably just the quotes around the string literal missing?

[NSString stringWithFormat:@"paginatePage('%s')",getPath]

Upvotes: 3

dominicbri7
dominicbri7

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

Related Questions