i have one page, b.html.erb, when i load that page,that have one text filed and button. when i click on that button, button class = sub123 (Here an ajax Get request will happen), after processing another div(that button class =addsubmit ) will shows in same page.
ajax
$(".sub123").click(function() {
var mnum = $(“#mnum”).val();
var dataString = ‘value=’+ mnum;
if(mnum==‘’)
{
$(‘.error’).fadeIn(300).show();
$(‘.error’).fadeOut(3000);
}
else
{
$.ajax({
type: “GET”,
url: “http://localhost:3000/bpages/show/”,
data: dataString ,
success: function(){
$(‘#billerTerminal’).fadeIn(200).show();
$(‘.checked3’).fadeIn(200).show();
$(‘.error’).fadeOut(200).hide();
$(‘.adddtl’).hide();
}
});
}
return false;
});
$(“.addsubmit”).click(function() {
var bnum = $(“#bnum”).val();
var bamount = $(“#bamount”).val();
var dataString = ‘bnumber=’+ bnum + ‘&bamount=’ + bamount;
if(bnum==‘’ || bamount==‘’ )
{
$(‘.adderror’).fadeIn(300).show();
$(‘.adderror’).fadeOut(3000);
}
else
{
$.ajax({
type: “POST”,
url: “http://localhost:3000/bpages/addt”,
data: dataString,
success: function(){
$(‘.adderror’).fadeOut(200).hide();
$(‘.addsuccess’).fadeIn(200).show();
$(“.addsuccess”).fadeOut(3000);
$(‘.adddtl’).fadeIn(200).show();
}
});
}
return false;
});
class BpagesController < ApplicationController
def show
//GET request…
@user_name = session[:user_name]
@password = session[:password]
//Here i can see these two values
end
def addt
/POST
@user_name1 = session[:user_name]
//HERE this SESSION is EMPTY…what am i wrong?
end
end
These two call happens in one page, why i didn’t get that session variable in another POST request…?
Thank you
vishnu