2

Trying to pass the variable "flickrurl" to a PHP page with jQuery/ajax. It works when using a plain text string and not the variable. Am I assigning the variable properly? See the full code in action here:

$trash.droppable({
                accept: '#gallery > li',
                activeClass: 'ui-state-highlight',
                drop: function(ev, ui) {
                    deleteImage(ui.draggable);
                                //set variable equal to src of image tag in #gallery > li
                        var  $flickrurl =  $item.find('img').attr("src");
                //pass variable to php page
                      $.post("updateDB.php", $flickrurl );

                }
            });
2
  • So you're going to thank ceejayoz but not accept his answer? Commented May 15, 2010 at 3:52
  • Hey @Walden, what Bradley is getting at is that its best for everyone (you, ceejayoz, the community) if you mark his answer as accepted. It puts a huge green check next to the answer to let future users know it worked. Commented May 15, 2010 at 6:36

1 Answer 1

5

jQuery's AJAX functions expect data in JSON form. Try:

$.post("updateDB.php", { 'flickrurl': $flickrurl } );
Sign up to request clarification or add additional context in comments.

1 Comment

I tried to click the check when I tested the solution, but for some reason it didn't take.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.