Jump to content

Dynamically loaded TextBox not working with Ajax


NebuJohn

Recommended Posts

Somebody please help me. The below given code is not working. 

 

  
$(document).on('keyup', ".add_commi", function() {
typingTimer = setTimeout(doneTyping, doneTypingInterval); 
var pro = $(this).attr('id');
var selectvalue = $(this).html();
 
var id = pro.slice(-2);
 
var amount = $('#amount'+id).html();
var rate = $('#v_rate'+id).html();
 
 
  //alert('working');
var data = 'cur_amount='+cur_amount +'&cur_rate='+cur_rate+'&commision='+selectvalue;
 
$.ajax({
 
type: "POST",
dataType: "json",
data: data,
 success: function(output){
 
var cus_rate = output.cus_rate;
var total = output.total;
var tot_commision = output.commision;
 
alert(cus_rate, total, tot_commision);
 
$('#curr_rate'+id).html(cus_rate);
$('#tot'+id).html(total);
$('#tot_commi'+id).html(tot_commision);
 
        }
        });
        
 
        return false;
 
  });
 
The problem is with Ajax calling. Can somebody give me a hint to rectify this. Thanks in advance. 
Link to comment
Share on other sites

Could you clarify please.

 

Please describe what is happening and what you expect to happen a bit more if you can. You say the problem is with AJAX calling. Is it returning the wrong info or no info etc Or do you mean it isn't even calling the other page? Are you getting an error like 'page not found'? Is it getting to the alert(). Can you give us a little bit more to go on.

 

edit: just had a quick read through...can't spot anything obvious at error on first run through. Only thing I can think of and this may not make any difference at all (and correct me if you know better - js not my strength)is: have you tried using the filename in the filepath the ajax is loading rather than just using the path and assuming it will automatically use index.php? In the code above it looks like you haven't named the file it should be loading. LIke I say I don't know if this will make a difference. Let us know the result either way. More info would be great.

 

Good luck.

Edited by wezhind
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.