Results 1 to 6 of 6

Thread: AJAX interaction into a PHP site using jQuery and the jQueryUI framework.

  1. #1
    Join Date
    Jan 2012
    Posts
    52
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Exclamation AJAX interaction into a PHP site using jQuery and the jQueryUI framework.

    Hello Everybody,

    Can anyone tell me, why editing is not working with this code ?

    This is the link :
    http://jeremydorn.blogspot.com/2011/...i-and-php.html

    When i incorporate this code. Than it displays ok. But when i want to edit the
    information it's not working.

    In addition to this it will be really very helpful if deletion can also be done with
    this code.

    Thanking You
    Megha

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by megha_3000 View Post
    when i want to edit the information it's not working...
    "it's not working" is very useless information. If it were working, you wouldn't be trying to fix it.

    What is going on? which part are you having a problem with? what do you expect to happen? what happens instead? what error messages do you get? We can't help you if you don't explain your problem.

    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Please be sure that you have included all relevant code and/or a link to the page in question.
    You might also consider making a reduced test case using an online tool like jsfiddle

  3. #3
    Join Date
    Jan 2012
    Posts
    52
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Default

    The problem is it has hidden form. When i click on edit their it gives data from the database.
    But the problem happens when i submit that edited data. The edited data doesn't
    make any change in database.

    And like edit if deletion of records can be added with the code then it will be very helpful for me.

    Please help me.

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by megha_3000 View Post
    The problem is it has hidden form. When i click on edit their it gives data from the database.
    But the problem happens when i submit that edited data. The edited data doesn't
    make any change in database.
    So, the data you enter into the form doesn't make it to the database?

    What does happen when you submit the form - do you get a response? an error message?

    Check your javascript console ([CTRL]+[SHIFT]+[J] in Chrome, for example) to see if your ajax call is succeeding (or even being sent, at all).

    If it is, you can add something like exit( var_dump( $_POST ) ); in the edit.php file to see if the data is arriving correctly.

    Some things to consider about the tutorial you're following:

    • die() is a very, very bad way to handle errors. It just stops everything right where it is and, well, dies. This usually results in a broken page, because you don't finish outputting the HTML markup. It is also very difficult to recover from - you can't try to fix anything after this point, sometimes the links/menus on the page won't work either.
    • Likewise, it is better to do PHP First, before outputting anything to the webpage. If this tutorial were designed that way, for example, then using die() would be less problematic because there would never be a broken page.
    • The tutorial has several other basic errors, including using PHP comments in HTML output (which, among other things, will break the JSON response edit.php tries to send you).
    • This tutorial has almost *zero* error-checking. For example, it sends queries to MySQL and then continues on, assuming everything worked, without checking. You'll get the same response from this script whether the UPDATE succeeds or fails; there's no way to tell if it worked without actually looking at the database.
    • You should always validate user input - this tutorial makes a basic attempt at sanitization, but passes submitted data to the database unchanged otherwise.
    • Speaking of UPDATE, this script gives *anyone* access to update your database. If this is anything more than a learning experience, on a non-public host, it really needs authentication of some kind (even if it's just submitting a password along with the UPDATE data).
    • The mysql_*() functions are deprecated. You should not be learning how to use them: learn using mysqli or PDO instead.
      (This tutorial was written about two years ago - ext/mysql was very outdated even then. ext/mysqli has been the recommended extension for MySQL since June 2004.)


    **********************************
    Quote Originally Posted by megha_3000 View Post
    And like edit if deletion of records can be added with the code then it will be very helpful for me.
    I'd recommend understanding the code and getting it to work "as-is" before trying to add features.
    If you're just asking for someone to do it for you, you can post in the Paid Work forum.
    Last edited by traq; 05-22-2013 at 07:49 PM.

  5. The Following User Says Thank You to traq For This Useful Post:

    megha_3000 (05-26-2013)

  6. #5
    Join Date
    Jan 2012
    Posts
    52
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by traq View Post
    So, the data you enter into the form doesn't make it to the database?
    Yes it is.

    Quote Originally Posted by traq View Post
    What does happen when you submit the form - do you get a response? an error message?
    No i don't get anything neither an error message nor a response.


    Quote Originally Posted by traq View Post
    Check your javascript console ([CTRL]+[SHIFT]+[J] in Chrome, for example) to see if your ajax call is succeeding (or even being sent, at all).
    It shows some error like:

    Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/images/jquery_ui/ui...eeee_1x100.png
    GET http://localhost/images/jquery_ui/ui...6666_40x40.png 404 (Not Found) jquery-1.4.4.min.js:166
    GET http://localhost/images/jquery_ui/ui...28_500x100.png 404 (Not Found) jquery-1.4.4.min.js:20
    GET http://localhost/images/jquery_ui/ui...ff_256x240.png 404 (Not Found) jquery-1.4.4.min.js:20
    GET http://localhost/images/jquery_ui/ui...f6f6_1x400.png 404 (Not Found) jquery-1.4.4.min.js:20
    GET http://localhost/images/jquery_ui/ui...f5ce_1x400.png 404 (Not Found) jquery-1.4.4.min.js:49
    GET http://localhost/images/jquery_ui/ui...ffff_1x400.png 404 (Not Found) jquery-1.4.4.min.js:129

    But it seems that these are image missing.

    Quote Originally Posted by traq View Post
    If it is, you can add something like exit( var_dump( $_POST ) ); in the edit.php file to see if the data is arriving correctly.
    When i did this the submit button of form didn't work. But gives an still look.


    **********************************

    Quote Originally Posted by traq View Post
    I'd recommend understanding the code and getting it to work "as-is" before trying to add features.
    Yes i want to make the script works too. So please help me.

  7. #6
    Join Date
    Jan 2012
    Posts
    52
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Default

    At last it is solved Thanks ALLAH and thank you all. The code at line 52 where written idid will be just only id.

Similar Threads

  1. Replies: 4
    Last Post: 08-26-2012, 02:21 PM
  2. $.ajax with jquery isn't working on my site
    By slashafk in forum JavaScript
    Replies: 1
    Last Post: 07-30-2012, 08:05 PM
  3. Replies: 0
    Last Post: 06-25-2012, 01:03 PM
  4. jQueryUI - Datepicker - Multiple Months
    By cancer10 in forum JavaScript
    Replies: 0
    Last Post: 12-30-2010, 03:19 AM
  5. AJAX interaction
    By city_coder in forum JavaScript
    Replies: 6
    Last Post: 04-15-2008, 04:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •