Jump to content

jQuery function won't run after DIV reload

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
sparkles

sparkles

    Newbie

  • Members
  • Pip
  • 1 posts
Howdy,

I'm using codeigniter, so the code is all over the place so I'm not going to post it unless requested!

I have a little bit of a problem, and would appreciate some help if anyone knows what I've done wrong!

I've got a couple of jQuery functions running AJAX commands in an external file on my homepage. When a user submits a form, the functions intercept and processes the data then reloads the DIV containing the form (and other things).

The code works fine for the 'first run', so to speak, but after one reload the function is ignored and the form tries to load a blank page (as I set the action="") instead. I have a second function which works fine over and over again, which also reloads the same DIV. However, the form that initiates this function lies OUTSIDE the DIV.

Is the fact that the form which is calling the function is inside the DIV it is reloading causing my issue?

Thanks guys, if this is too confusing, I'll post the code :)

Sparkles*

#2
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
jQuery ajax evals the javascript in the return before calling the success or the complete callback.
your problem might be running the javascript for loading form with ajax once on page load and again on second page request. i would send a GET, POST param that tells the second page that it is ajax and shouldnt add the javascript thats already loaded.
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript