• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
returning value from jquery to controller

hi,Can anyone tell me how to return a variable from a jquery function in view to controller?
for example this is what i have written in my view file :


var i=0;

$("button").click(function () {
         [b]return i;[/b]             [i]how to return this i variable to controller[/i]  

function myFunction()
    $("button").after('<input type="text" name="n"/>',i);

Actually i know how to pass values using anchor() to controller but it seems different i have tried. Please help me out in passign this i's value from script to controller.

Thank you

search on 'AJAX' keyword.

Use jQuery's load function to call your controller method.

Echo the data from the controller function and it will be returned to your view.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.