Jquery with CI |
[eluser]finord[/eluser]
Hello, i have problem with this script. I try to send data usng ajax( with jQuery) , and insert to bd (mysql). But i dont know why dont work ajax, the go directly to the controller url. Controller: Code: <? Model: Code: <? View: Code: <? If anyone can help me i think the problem is on the javascript code, but i test with other php code("normal" php code, NO with Framework or something) Thanks
[eluser]Nick Husher[/eluser]
Question: when is the jquery script ever getting called?
[eluser]finord[/eluser]
Here: Code: >script> thanks
[eluser]Nick Husher[/eluser]
I think you misunderstood, that's where the script is being defined, not where it is being called. Defining a function in javascript looks like this: Code: function MyFunction(args) { ... } Code: MyFunction(myArguments); Note: there are actually a handful of ways to both define and call functions in Javascript, but the most codified ways are delineated above.
[eluser]finord[/eluser]
I use this example form a some forum to do this, and with this code work, i test it. index.html Code: <html> And the Post.php Code: $fname = $_POST['fname']; I try to use jquery docs, but cant do it work, for hat use this example. Thanks
[eluser]thesf[/eluser]
I think the problem is that your missing the document ready bit within your script tags. http://docs.jquery.com/How_jQuery_Works#...B.7D.29.3B
[eluser]diego.greyrobot[/eluser]
Yea for one i see some typos in your code mainly where your script tags are, you have them like this: >script> make them [removed] also you need to take $.post(..) out of the post() function and instead enclose it in ... $(document).ready(function(){ $.post(...); }); also you'll probably want to have an event trigger an ajax call like this... $(document).ready(function(){ $('#submit_button').click(function(){ $.post(...); }); }); that way the $.post() function at the right time.
[eluser]Colin Williams[/eluser]
What will really help you down the line is to not just copy, paste, and cross your fingers. Learn how the code works. |
Welcome Guest, Not a member yet? Register Sign In |