Webmasters › Re: Where Is This Error Coming From Please by cbrass(op): 6:07pm On Jul 13, 2015 |
onyengbu: I dont understand. Does the click on the linl both launch modal as well as POST the variables all at the same time? yes |
Webmasters › Re: Where Is This Error Coming From Please by cbrass(op): 3:06pm On Jul 13, 2015 |
onyengbu: 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. 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? |
Webmasters › Where Is This Error Coming From Please by cbrass(op): 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(){ $("#edit" .click(function(e) { e.preventDefault(); var id = $(this).attr("data-edit" ; var usern = $(this).attr("data-owner" ; var dataString = 'id=' + id + '&user=' + usern; $.ajax({ type: "POST", url: "../config/edit.php", data : dataString, cache: false, success: function(html){ alert(html); } }); }); }); <?php $id = $_POST['id']; $usern = $_POST['user']; $sel = "SELECT * FROM page_timeline WHERE timelineID = '$id' AND user ='$usern' "; $selt = $db->query($sel); while($row = $selt->fetch_array()) { echo $row = ['post']; } ?>
from the php end am getting id,user undefined. of course i know what could have caused that but what i think is the ajax is not passing the values to the php but i dont know how that could have happened. 
adewasco2k onyengbu, guru01 etc |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 9:49am On Jul 08, 2015 |
onyengbu: Good. Have you done it? Not yet because I already moved to other things, that one was taking too much of my time but with what I see there I have a clue to how I should fix it however I don't mind if you post the solution you promised. |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 4:16pm On Jul 07, 2015 |
onyengbu: I am on mobile and can offer very limited help here. However, your issue have a very very simple solution. Since you are using query, there a lot of possibilities. You can just use add an attribute to the a href link that launches the modal box. By attribute I mean id, rel, class or even non HTML imagined ones that is only if you have ran out of standard HTML attributes for that element. JQuery will recognize it. Let's say you added an attributed named ahr to the link, and the link looks like this: <a href="javascript:void(0)" ahr="23">Edit</a> , you can create a variable from it in jquery like this: var thisID = $(this).attr("ahr" ; With this, you can then use query load() to load the db returned values specific to the query variable - thisID into the text area or content editable div where you can modify the db content and then send back via query/ajax request.
I will create a complete sample code when I get to a PC. Am very greatfull sir, thanks alot |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 4:15pm On Jul 07, 2015 |
maekhel: Why not attach the post id to the edit link then use the id in your where clause in your update query Yea... am beginning get the idea nw thanks |
Politics › Re: Workers Fleeing From Explosion Scene In Zaria, Kaduna (Photos) by cbrass(m): 12:18pm On Jul 07, 2015 |
What does these Muslims derive in blowing up themselves sef  |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 12:16pm On Jul 07, 2015 |
maekhel: Why not attach the post id to the edit link then use the id in your where clause in your update query That will only work if I want to redirect to another page but it's a pop up containing a textarea below that I want to use I don't want ppl to go to another page. You know like Facebook edit where you stay on your timeline when you be ant to modify a post |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 9:33am On Jul 07, 2015 |
maekhel: First of all where is $postID coming from? From a previous code above |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 9:32am On Jul 07, 2015 |
adewasco2k: All you need is the HTML5 data attribute
add this data-id="$id" to the post you are editing then you can use element.getAttribute('data-id') to get the id of the post.
i dont really understand your question but this will help What am trying to do is when users click on the<a href=> edit link </a> it should pop up. The window of that post but when I did it it just picked any post and not the actual post that has the edit link. Of course I know why it's doing this but how to fix it is what I don't know yet or do you have a code for pop ups |
Webmasters › Re: Who Can Solve This Problem Pls by cbrass(op): 4:15am On Jul 07, 2015 |
I forgot to add the hurry part sha, my jquery knowledge isn't sound enough  |
Webmasters › Who Can Solve This Problem Pls by cbrass(op): 4:03am On Jul 07, 2015 |
|
Politics › Re: A Copy Of The SSS Memo That Suspended Marilyn Ogar, Others by cbrass(m): 8:05pm On Jul 05, 2015 |
nkemdi89: So you are happy abi has anything be added to your account? Fyi she is a fulfilled woman pray to reach that her height in your choosen career . Oh now i see where you are coming from, well I pray never to be like her. The 2015 elections and the drama is still fresh in our memories  |
Politics › Re: A Copy Of The SSS Memo That Suspended Marilyn Ogar, Others by cbrass(m): 5:53pm On Jul 05, 2015 |
nkemdi89: These are confidential and restricted document meant for the service consumption and not for the general public, my prayer for the person divulging such information to the public and also other moles in the organisation is that they will never have peace of mind and rest in their career, for God sake this isn't fair no matter how disgruntled that person or people are, they shouldn't be doing these. Mod you people should not just post anything sent to you online please. What's your problem with this, are you related to maryln orga or what  fyi the s in sss has been replaced with D so... |
Romance › Re: Obama Finally. Weds Mugabe (pics) by cbrass(op): 4:07pm On Jul 02, 2015 |
MasterRahl: So an 80-year old man is strong enough to carry Obama? PHOTOSHOP!  It's love  |
Politics › Re: Modupe Ozolua Visits Communities Destroyed By Boko Haram by cbrass(m): 12:47pm On Jul 02, 2015 |
glimpse33: This is the 7th time today I am making FTC at Front page! If only Seun was paying me 
@topic Just Imagine! I Feel for the villagers tho! God bless Empower54 God bless Nigeria OK I will pay you |
Romance › Re: Obama Finally. Weds Mugabe (pics) by cbrass(op): 1:06pm On Jul 01, 2015 |
[quote author=robinicule post=35346016][/quote]This won't help you bro  |
Romance › Obama Finally. Weds Mugabe (pics) by cbrass(op): 6:05am On Jul 01, 2015 |
He finally. Said I Do 
|
Sports › Re: Probably The First National Team To Play Outside Africa (pics) by cbrass(op): 8:05pm On Jun 30, 2015 |
Zonacom: Chai! See jersey. I'm sure baba iyabo the tailor was in charge of that department as at then  |
Sports › Re: Probably The First National Team To Play Outside Africa (pics) by cbrass(op): 7:33pm On Jun 30, 2015 |
|
Sports › Re: Probably The First National Team To Play Outside Africa (pics) by cbrass(op): 7:32pm On Jun 30, 2015 |
Incase introvert gets here before me 
|
Sports › Probably The First National Team To Play Outside Africa (pics) by cbrass(op): 7:31pm On Jun 30, 2015*. Modified: 8:05pm On Jun 30, 2015 |
It will shock you to know that the first ever national team to play outside the shores of Africa was the super eagles of Nigeria . The pics below was taken in England in August 29 1949, They played the Amature England National Team on that day 
|
Celebrities › Re: This Guy Says He Looks Like John Dumelo by cbrass(m): 8:03pm On Jun 29, 2015 |
Karleb: @cbrass How will you convince me that that is not you? GOD FORBID BAD THING OO |
|
|
Crime › Re: Beninoise Wife Poisons Husband Over Boyfriend In Lagos (PHOTO) by cbrass(m): 7:58am On Jun 29, 2015 |
olempe: * Police arriving in six vans to arrest an unarmed suspect  I thought I was the only one that saw that  when she is not shekarau |
Politics › Re: We Regret Voting Buhari – South West Leaders by cbrass(m): 7:34am On Jun 29, 2015 |
OduaVanguard: You mean those bitter, hate-filled and chest-beating Biafrauds ?  Thou sayest  |
Politics › Re: We Regret Voting Buhari – South West Leaders by cbrass(m): 11:52pm On Jun 28, 2015 |
sureleads: Common man, this topic has been overfloggd alraedy.....at least av seen up to 4 differnt users recycling same topic, and you are doing it again. I thought you were a mod on this forum
As a mod, you should be cleanin up, rather than join the recyclers.....then again, your bigotry won't let you
As the topic seems to be against Yoruba interest, you just eager to share it. You have a problem that you av not realised yet....a strong inferiority complex to Yoruba. and you can never meet up....Never Don't mind them, if you look at the percentage of those happy with the brouhaha in the NASS you will discover they all come from one particular region in this country. I don't know what Yoruba ppl did to them
|
Politics › Re: We Regret Voting Buhari – South West Leaders by cbrass(m): 11:49pm On Jun 28, 2015 |
Lies from the pit of hell, there is another news now that buhari snubs tinubu and threatens to return to pdp. 
|
Family › Re: See What A Lady Posted About Husbands & Wife Battery: Women Do You Agree? by cbrass(m): 10:31pm On Jun 28, 2015 |
nomabeeee: f and v...an error..thanks for correcting. You welcome love  |
Family › Re: See What A Lady Posted About Husbands & Wife Battery: Women Do You Agree? by cbrass(m): 10:30pm On Jun 28, 2015 |
|
Programming › Re: This Robot Can Build A House In Two Days by cbrass(op): 4:21pm On Jun 28, 2015 |
|