Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP Ajax jQuery
Hi
I hope I did not come to the wrong site but I need some light in terms of posting data using ajax and jquery I don't know where I'm going wrong hence I'm new to jquery and ajax any assistance will be appreciated
 
I have this code
        var query = "companyname=" + companyname + "&Address1=" +address1 ;
                            query+= "&Address2=" + address2 + "&Area=" + area+ "&city="+city +"&code="+code;
                            query+= "&Province="+Province +"&fullname="+fullname+"&surname="+surname+"&email="+email +"&pass="+pass+"&number="+contacts+"&choice="+usertype;
                           
                          alert(query);   
                            $.ajax({                            
                                type :"POST",
                                url :"inc/functions.php?action=newagent",
                                data : query,
                                success: function(data){ 
                                    if (data =='Success'){
                                        //setTimeout('proceed()',5000);
                                        alert("Success using Jquery");
                                    }
                                }});
Posted 1-Oct-12 2:06am
Edited 1-Oct-12 2:25am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It is nice to have some code. Do you have a question as well Smile | :) ?
  Permalink  
Comments
Member 7763261 at 1-Oct-12 8:41am
   
Yes kenneth my question is what am I doing wrong here because the ajax fuction is not posting the query to the relevant php file so that data can be processed i.e This function is not working and I cant peak up why I've tried to trace but I cant find the bug please me where I'm going wrong $.ajax({
type :"POST",
url :"inc/functions.php?action=newagent",
data : query,
success: function(data){
if (data =='Success'){
//setTimeout('proceed()',5000);
alert("Success using Jquery");
}
}});

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 310
1 PhilLenoir 164
2 Richard MacCutchan 160
3 Sharmanuj 146
4 Magic Wonder 129
0 Sergey Alexandrovich Kryukov 6,081
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 1 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100