Welcome Guest, Not a member yet? Register   Sign In
Jquery Database Query and handling output.
#11

[eluser]pickupman[/eluser]
You are binding to the click event of a form. You don't click the form element, you click the submit button. You either need to use the .submit handler, or bind to the submit button.
Code:
$('#frmLogin :submit').click(function(){}); //bind click to submit button in login form
//or
$('#frmLogin button#submit').click(function(){}); //same as above
//or
$('#frmLogin').submit(function(){}); //bind to submit event for the form
#12

[eluser]jblack199[/eluser]
that was just quick code...

I've done the document.ready, i did a bind on the button itself not on the form....

i also did the $('#submit').click, and lots of stuff... none of it works in an external file, which i suppose is fine but would eventually need to be resolved if i release this software (which V1 i probably wont)...
#13

[eluser]pickupman[/eluser]
Try using Firebug in Firefox, with the console enabled. You may be triggering a js error or something. Maybe unrelated to this issue, but if there is a js error before this is executed, it will break further bindings. Also make sure jQuery is loaded before you link to the external.
#14

[eluser]jblack199[/eluser]
done that too -- there have been zero errors showing up in firebug.. and jquery is loaded first.. it just dont want to work lol...
#15

[eluser]Rolly1971[/eluser]
just a thought here, i started using CI at 1.7.2. I had issues getting the form helper functions working correctly. So i stopped using them. All my forms are purpose built basically static html. Try creating your form as static html (using php where needed to echo out default values)

also try adding your jquery code to the bottom of the page, just before the ending </body> tag.

don't forget to that when you write your jquery code that it should be formed like this:

Code:
$(document).ready(function() {
  //example:
  $( "#loginsubmit" ).click(function() {
    var loginform = $( "#loginForm" ).serialize();
    var url = "<?php echo site_url('auth/login'); ?>";
    var data = $.post(url, loginform , function(data){
                     // code here to process json response
           });
  });
});

that is what works for me. Hopefully it helps.




Theme © iAndrew 2016 - Forum software by © MyBB