jQuery thickbox not saving data
I am using jQuery thickbox to popup a window to add records when I click on an add link. It pops up the window but doesn't add the records to database. Although when I directly access this page to add records, it's working fine.
But in popup window it's not same for add and edit. When I click on save button, the popup window hides and I am not able to see what the proble开发者_开发知识库m with this page. I also want that this window will not be hidden when I click on save
button.
Can anybody help me?
Thanks in advance...
I have implemented something similar to what you looking for..Hope this helps. Firstly,I called a page(suppose record.pl) in POPUP using thickbox using this code in main.pl.
main.pl code:
print'<script type="text/javascript" src="/javascripts/jquery.js"></script>
<script type="text/javascript" src="/javascripts/thickbox.js"></script>
<link href="/stylesheets/thickbox.css" rel="stylesheet" type="text/css" />';
print '<a href="record.pl?KeepThis=true&TB_iframe=true&height=400&width=600
class="thickbox" >Add new record</a>';
record.pl code:
print $cgi->startform(-method=>'POST', -action=>'database.pl');
--------------------------------------
print $cgi->endform;
database.pl code:
$record_value=$q->param('record');
Now make the connection to ur database.
eg. $connect = DBI->connect($dsn, $user, $pw);
and make the query something like
e.g $myquery=Insert INTO $tablename VALUES(............);
$query=$connect->prepare($myquery);
$query->execute();
It worked for me..Hope this works for you too ..Happy Coding !!
I was also having same kind of problem while using Facebox. Using Ajax submit in my page which opens in popup solves the problem. Now the popup windows stays there even after submitting the form. I hope this will also work for you. Follow the link on how to submit the form using ajax and jquery.
精彩评论