Passing Data Variables From Php To Jquery Ui Dialog
I have this bit of php code: getPosts() as $post){ ?>, function() {
var postid = $(this).data("post-id");
var answer = $("#insert-answer");
$(answer).data('post-id', postid);
$(answer).dialog( "open" );
});
, function() {
var postid = $(this).data("post-id");
var answer = $("#insert-answer");
$(answer).data('post-id', postid);
$(answer).dialog( "open" );
});
And then grab in in the "Add idea": function() {
part with:
var forpost = $("#insert-answer").data("post-id"),
author = $(".author").val(),
idea = $(".idea").val(),
pic = $(".pic").val();
So what you are doing is basically saving the current post-id
to #insert-answer
and getting it from there in your dialog. Is this what you were after?
"Add idea": function() {
part with:var forpost = $("#insert-answer").data("post-id"),
author = $(".author").val(),
idea = $(".idea").val(),
pic = $(".pic").val();
post-id
to #insert-answer
and getting it from there in your dialog. Is this what you were after?UPDATED CODE: @charlietfl is absolutely right, var post-id
is not correct, I have edited the name of the variable.
Post a Comment for "Passing Data Variables From Php To Jquery Ui Dialog"