Calling C# function from Javascript in ASP.NET

C

Camacho

Hi,

I'm trying to call a Server side function without AJAX in Javascript
not VBScript, but I don't know who to pass as a parameter value that
is in Javascript:

Function blabla()
{
....

<% Pedro(VAL); %>

....

}


VAL is a javacript value.

But compiler just not recognize it!

Who can I do that?????????

HELP


Thanks,
Pedro
 
P

Peter Michaux

Hi,

I'm trying to call a Server side function without AJAX in Javascript
not VBScript, but I don't know who to pass as a parameter value that
is in Javascript:

Function blabla()
{
...

<% Pedro(VAL); %>

...

}

VAL is a javacript value.

But compiler just not recognize it!

Who can I do that?????????

This newsgroup is mostly about client-side JavaScript and mixing in
server-side code/logic will confuse folks as everyone seems to use
different server-side technology. If you frame your question in purely
client-side technology (i.e. HTML, CSS, JavaScript) then you will be
writing in the area we all have in common.

For example, I don't know why "Function" would have a capital 'F' so
it makes me wonder if the above code has an error and is to run on the
client-side or not.

Possibly you are looking for the following

<URL: http://jibbering.com/faq/#FAQ4_34>

Peter
 
C

Camacho

Hi,

Forget the F or f because that was one example, It is really in client
side, in Javascript.

Regards,
Pedro
 
P

Peter Michaux

[posting order restored. Please don't top post.]
Forget the F or f because that was one example, It is really in client
side, in Javascript.

Then perhaps the link I posted is sufficient. If not you haven't made
your objective clear enough for me to understand what you are trying
to do.

Peter
 
C

Camacho

Hi,

if I do this

<% Pedro(); %> it works

but I don't know how to concatenate the VAL variable that is in
javascript into that

<% Pedro( + VAL + ); %> this will give one error, do you know the
correct syntax?

Regards,
Pedro


[posting order restored. Please don't top post.]


Forget the F or f because that was one example, It is really in client
side, in Javascript.

Then perhaps the link I posted is sufficient. If not you haven't made
your objective clear enough for me to understand what you are trying
to do.

Peter
 
J

Joost Diepenmaat

Camacho said:
Hi,

if I do this

<% Pedro(); %> it works

This calls a function in the server code /before/ (that part of) the
page is sent to the browser. When the browser reads the page, the server
process is already doing something else.
but I don't know how to concatenate the VAL variable that is in
javascript into that

<% Pedro( + VAL + ); %> this will give one error, do you know the
correct syntax?

This seems to be an attempt at directly calling some server-side
subroutine from browser-side javascript code (with a lot of confusing
syntax put in). It's possible to abstract a large part of that, but if
only for security and the basics of HTTP things aren't remotely as
simple as that in detail.

By far the simplest way to solve the general problem of moving
javascript data to the server is to use html forms or
XmlHttpRequest. Forms are simplest, but XHR is more flexible. Search on
those terms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top