Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,201,380 members, 7,978,214 topics. Date: Thursday, 17 October 2024 at 10:08 PM |
Nairaland Forum / Science/Technology / Webmasters / Where Is This Error Coming From Please (1317 Views)
How Do I Stop This Error On My Wordpress Site ? / Where Is Your TRAFFIC Coming From. / How Do I Fix This Error (2) (3) (4)
Where Is This Error Coming From Please by cbrass(m): 10:14am On Jul 13, 2015 |
This is the html link <li><a href="#" class="btn btn-info btn-sm" id="edit" data-toggle="modal" data-target="#modal-form" data-owner="<?php echo $op; ?>" data-edit="<?php echo $postID; ?> ">Edit Page</a></li> This is the Jquery code $(function(){
|
Re: Where Is This Error Coming From Please by onyengbu: 12:42pm On Jul 13, 2015 |
cbrass:By mere looking, i cant pin point anything specifically but i have my suspicions. If it were me, i will troubleshoot by first assigning values to the variables directly to id and usern. That is, i will just say var id = "2"; var usern = "3"; then run it again and see what gets posted to php. If I still get undefined, I will rename the attributes in the <a> element to something like dataowner and dataedit; that is get rid of the dashes. Another place to look into is the assignment of usern varibale in the datastring. Why not say usern=' + usern and then catch is as $usern = $_POST['usern']; in your php. Lastly, i noticed your click event is tied to an ID. As you well know, ids are meant to be unique on a page so make sure you dont have another <a id="edit" on that page. If the <li> is returned in a loop, there is definitely more than one of it on the page and that is trouble! To avoid that tie the click event to a class. I am almost certain one of these will.solve the problem. |
Re: Where Is This Error Coming From Please by cbrass(m): 3:06pm On Jul 13, 2015 |
onyengbu: Thanks alot for your concern, one thing I noticed it I removed that modal link so it doesn't have to pop up, and I.used alert() to know what's wrong I discovered that the PHP indeed recieved those information from the Ajax and I can see the id and the owner of post but when I switch back to the modal and the window pops up onclick it shows that undefined index thing again. So is that the popup is not waiting for Ajax to send the information before firing? |
Re: Where Is This Error Coming From Please by onyengbu: 5:14pm On Jul 13, 2015 |
cbrass:I dont understand. Does the click on the linl both launch modal as well as POST the variables all at the same time? |
Re: Where Is This Error Coming From Please by cbrass(m): 6:07pm On Jul 13, 2015 |
onyengbu: yes |
Re: Where Is This Error Coming From Please by onyengbu: 1:15am On Jul 14, 2015 |
cbrass:I dont know why you may want to do that but I am not sure it is the right thing to do. If the modal launch is to confirm the click even, you can just implement it in such a way that the click POSTs the variables and the executes your php and if the query is successful, you echo the js that will launch the modal from php. |
Re: Where Is This Error Coming From Please by cbrass(m): 8:59pm On Jul 14, 2015 |
onyengbu: I thought of this too but the issue I have is the modal only fires when clicked so Which means that method may not work. I didn't write the modal script I saw it some where.if I can get one that fires on page load that your method will work |
Re: Where Is This Error Coming From Please by onyengbu: 3:13am On Jul 15, 2015 |
cbrass: Again I dont fully understand the context but assuming you are just aiming to load the the details returned from your page_timeline table into that modal box heres how I will do it. 1. Launch the modals and 2. Load a page with the attributes as query strings into it (i named the page db-stuff.php). I made my own modal here as you can see. main-page.php
db-stuff.php
Remeber to add jquery library |
Re: Where Is This Error Coming From Please by cbrass(m): 12:14am On Jul 17, 2015 |
Thanks alot bro, will try it out |
Re: Where Is This Error Coming From Please by onyengbu: 3:40am On Jul 17, 2015 |
cbrass:Good. Let me know how it turns out. |
Re: Where Is This Error Coming From Please by cbrass(m): 11:02pm On Jul 17, 2015 |
onyengbu: Please did you test the code? Cos Nothing is popin up |
Re: Where Is This Error Coming From Please by onyengbu: 1:22am On Jul 18, 2015 |
cbrass:Yea, tested it ok. Hope you added your jquery library and removed all the nairaland injected "wink" Heres the fiddle : http://jsfiddle.net/fa6rosps I commented out the .load(db-stuff.php) part and loaded the modal directly into the page with .html() since I cant load external file there |
Re: Where Is This Error Coming From Please by cbrass(m): 8:44pm On Jul 20, 2015 |
onyengbu: Thanks alot bro, I impletmented your example and some stuffs to it and it worked but I have another issue here. The edit link only picks one post-id ( posts and their ids are looped through the db and echoed on the page with the edit link right beside them) I have almost 10 posts Soviet should have 10 ids, I can't understand why the edit link only is picking one id in the loop |
Re: Where Is This Error Coming From Please by cbrass(m): 10:17pm On Jul 20, 2015 |
Don't worry bro, have fixed it. Thanks a billion times |
Re: Where Is This Error Coming From Please by onyengbu: 2:08am On Jul 21, 2015 |
cbrass:Glad you did it. I was going to tell you not to get rid of IDs on a loop but I believe you figured it out on your own. |
(1) (Reply)
HELP ME, I Want To Learn Web Designing And Blogging, How Do I Go About It Ooooo / Verified Nigerian Adsense with $19 For #40,000 !! / Verified Nigeria Non Hosted Adsense Account For Sale
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 41 |