Okay. I'm returning a result-set from a PHP-file via JSON (json_encode()). However, for some reason, I can't access the result in the displaying file. Let me clarify: I'm returning an HTML form, with radiobuttons and checkboxes etc. - this returns fine, but I can't, for some reason, access the form elements via jQuery. I thought a simple $('selector').on('click', function() {}) would allow me to access the returned values, but for some reason it doesn't work. I'm a little baffled - how would I access the returned form/elements from an outside function? As far as I understand, .on() should target dynamically created elements, and should work on the Ajax-returned elements. I had a look at the JSON returned, and every HTML-element is returned with escaped double quotes - I'm just wondering if that's the reason? Anyone have any hints?
Well, it seems I fixed it (sorta) by adding it to a named function, and calling that function in the callback from the Ajax-function. Although I still have some issues with the form, I'll post separate questions about that.
Not sure if this was the issue, but it seems like you had problems with where you wanted to handle the new data. It should be in your callback, and oftentimes I find putting my new jquery in my ajax file (the php file being called) works the best, but really only if what is being returned is supposed to be HTML and javascript (not variables).
Figured the problem out - a bit too lengthy to get into here, but it was some other parts of the script messing with IDs and name-tags, hence making what I thought was the correct access-function behave a bit irratic. Fixed it, as I said, and it works just fine now. However, I had to make the things I wanted to do into a function, and call it inside the callback for the $.post to be able to access all the information I needed.