« first day (21 days earlier)      last day (4932 days later) » 

12:00 AM
`if (some error condition) {
header(...);
return(json);
}`
if that is the case, then yes it will work with your regular data just fine
 
shouldn't headers be at top
Ok thank you
@drachenstern I truly appreciate your help, that you could stand me out
 
@Johnson I don't mind helping. Just know that sometimes you need to slow down and hear us
 
@drachenstern Okay, I am really trying, and sometimes I am worried if i ask too much in detail which can lead to someone giving up on me helping.. but it's alright i understand how they feel :-)
 
So long as you a) try and b) pay it forward, it's fine by me
but now, I need to leave for the evening
my SQL is running two large imports and I'm ready to go home
 
me too, the time got alot..
 
12:09 AM
yes the time did get away from us
 
thank you again have a good day
 
you too, and a good weekend
 
12:29 AM
Anyone know of good way to define an image with the src attribute defined in one line?
Something like var x = new Image().src = 'funnycat.jpg';
My best guess is to have an imageFactory() function that defines it.
 
 
8 hours later…
jjj
9:01 AM
anyone have a problem ?... I am here for it ..maybe i could solve it or help you with an idea
 
Tek
Have you used TinyMCE RTE?
 
jjj
9:16 AM
no
 
Tek
lol ok, well... maybe you can help me next time
xD
 
jjj
you are welcome
 
 
3 hours later…
12:19 PM
0
Q: jQuery: ajax inside another? smart?

JohnsonI have this ajax call at the moment: $.ajax({ url: "misc/sendPM.php", type: "POST", data: data, success: function(stuff){ if(typeof stuff == "object") { var err = confirm(stuff.error); if(err){ alert('You pressed OK'); // MAKE AJAX CALL HERE HERE HERE HERE }else{ ...

 
Tek
@YiJiang I see you're there. Quit hidin'! :p
 
@Tek Hehe :P What can I do for you?
 
Tek
@YiJiang Oh nothing, just wanted to say hi. :D
 
 
3 hours later…
3:05 PM
oh nice, there is also a chat here. hello everybody :)
 
Tek
hi hi
@shapeshifta Funny, this is from the PHP room
SalmanAbbas007
85167 9:37:00
cool we can chat too :p
 
3:58 PM
If i have my form elements with values in data (used: var data = $(this).serializeArray();)

How can i do change the value of an form element(called recipient), when it's inside data?
e.g if a element with name=recipient have value "mama", how can i change it to "papa", when it's has been serialized array
 
 
2 hours later…
6:07 PM
0
Q: jQuery: making a div inside ajaxcall

JohnsonOk. If you didnt spell a full name right, and only entered the lastname, and the there exist more users with that lastname, in the recipient field, the ajax call will return an error with Who did you mean: Mami Fox Megan Fox Blabla Fox Now, I would like to make so you can click on them, choo...

 
6:19 PM
@Johnson how would you solve it in words?
 
 
2 hours later…
8:02 PM
@drachenstern In words?
 
8:17 PM
Hello here
*there
quick question
Do you know what the technique is when you add sometihng like the facebook widget on your website?
 
@whobutsb 'Its called embedding
 
 
1 hour later…
9:27 PM
If i have JSON response:
{"names": ["Mami Fox","Megan Fox","Blabla Fox" ]}

How can I make a loop that makes a link for each name, example: <a>Miami Fox</a>
 
9:49 PM
@drachenstern are you here?
How can I make JSON response like this in PHP:
{"names": ["Mami Fox","Megan Fox","Blabla Fox" ]}
When i do: json_encode(array('names' => $name));
It turns out: {"names": "Name"} and I need to have more values in one variable like above
 
10:04 PM
bump
 
10:18 PM
why do you need more values in one variable?
all you need is to iterate over the values in the array
I don't know how to put the values in a JSON array from a php array.
I work in C# and it does the translation for me based on object name
 
Just to be clear, $name = array("Mami Fox", "Megan Fox", "Blabla Fox") right?
 
yeah, I believe so
that's what I was just looking up on the PHP site
But I didn't want to turn to the authoritative reference for my language, that would've been silly...
 
10:38 PM
@drachenstern sorry my bad, i didnt think enough
no
$name[] = array("Mami", "ee", "uu");
then i just did echo json_encode(array('name' => $name));
works like a charm now
Is there any function in JS equal to the implode() in PHP ?
 
Yes, it's called join
["x", "y", "z"].join(",")
 
What if i have:
$("#pmResponse").append("<a class='SuggestionName' id='"+names[i]+"'>"+names[i]+"</a>");
and would like to have an "," between the links
(it's in a foreach)
 
Appending in a for loop is in general a bad idea
 
Why?
 
I would add them to an array in teh for loop, then at the end use join on that array, then finally use append after all that is done
It's a bad idea because you are modifying the DOM, which is slow, every time you go through the loop
Better to do only one modification, at the end, with a single append
 
10:42 PM
hmm
well i cant have links into an arry
 
Why not?
 
var names = stuff.names;
for ( var i in names )
{
$("#pmResponse").append("<a class='SuggestionName' id='"+names[i]+"'>"+names[i]+"</a>").show();
}
How should i add them into an array?
 
Give me a second
var nameLinks = [];
for (var i = 0; i < stuff.names.length; ++i)
{
    var name = stuff.names[i];
    nameLinks.push('<a class="SuggestionName" id="' + name + '">' + name + '</a>');
}

var allNameLinks = nameLinks.join(', ');
$("#pmResponse").append(allNameLinks);
You can just put strings in arrays, it is not hard.
 
Nice method
Nice thank you @Domenic
 
:)
 
11:21 PM
Hmm.. If i have an fancybox at pm.php, and im inside pm.php?v=11, is there a way to make a link that goes to pm.php and then automaticly open up the fancybox?
 
yes, you append a GET string variable (for instance ?show) and then in the PHP when you parse the page, add a <script>$(document).ready(function(){showfancybox();});</script> if that GET string is found
 
Smart, thank you
showfancybox(); don't work
neither $.fancybox.show();
hmm
 
11:39 PM
it was an idea
not an exact implementation
I also don't know if you need to put ?show=1 or other implementation specific details
 
you wanted an idea and an example
 
Doesn't seem to be an show() function
I have done ?mode=new
Which works great, just debugged with alert()
guess it's not possible.
 
how do you normally show the fancybox?
 
on click
you set properties, telling a#blabla
should have fancybox
 
11:41 PM
then do the same thing in the pageload
better would be to make a single function
so in your page, define a function like so:
function showfancybox() {
 
I cant do the same thing in the pageload
as I got nothing to set the properties on ?
I want it to open auto, on ?mode=new
 
look, create a function whose sole purpose is to make the fancybox
then in the onclick you can pass the value, or in the pageload
without having to duplicate the code
but you have to do it the same in both places
in pageload and in onclick you have to create the fancybox the same both ways
well, the same aside from the specific data you want loaded, of course
there's no magic in programming, there's only elegance and planning ahead
 
I know that
But what should the function contain?
 
I'm not sure
whatever you need to create the fancybox
 
Me neither
 
11:46 PM
will you know the element it needs to be created on beforehand?
look here @Johnson ... are you already creating a fancybox anywhere on the page?
 
You usually create a fancybox like this:
$("a#newPM_a").fancybox({
'titleShow' : false,
'width': 560,
'height': 220,
'autoDimensions': false,
'overlayOpacity': 0.6
});
then it's <a id="newPM_a" href="#theBoxthatshowsFancy">open me</a>
 
then make a new function that looks like this:
function showfancybox(element) {
$(element).fancybox({
'titleShow' : false,
'width': 560,
'height': 220,
'autoDimensions': false,
'overlayOpacity': 0.6
});
}
 
I have a fancybox on the page yes, with a link.. but in PM.php, when you go to PM.php?v= I want to link to the PM.php, and open the fancybox auto
Yes but what should the "element" be?
 
and try it with the other code I gave you as well and tell me if it works
just like I gave you, don't make any changes
 
if its ?mode=new you run from, you dont press anywhere
 
11:49 PM
I want to see something
 
ok
if($_GET['mode'] && $_GET['mode'] == 'new'){ ?>
<script>
$(document).ready(function(){
function showfancybox(element) {
$(element).fancybox({
'titleShow' : false,
'width': 560,
'height': 220,
'autoDimensions': false,
'overlayOpacity': 0.6
});
}
});
</script>
<?php } ?>
ops forgot to run the function sec
 
no no no
in the page header define the function
I have you the portion to include in the page
 
showfancybox(-here-?);
 
23 mins ago, by drachenstern
yes, you append a GET string variable (for instance ?show) and then in the PHP when you parse the page, add a <script>$(document).ready(function(){showfancybox();});</script> if that GET string is found
I can see I need to give you one by one instructions
somewhere inside the <head> block
put a <script type="javascript"> </script> block
in that block put the function I gave you
 
done
 
11:53 PM
so:
 
<script>
$(document).ready(function(){
showfancybox();
});
</script>
I only have this now in pm.php
in my headers i have the function
 
<head>
<script>
function showfancybox(element) {
$(element).fancybox({
'titleShow' : false,
'width': 560,
'height': 220,
'autoDimensions': false,
'overlayOpacity': 0.6
});
}
</script>
</head>
damn formatting
 
yes yes, i have it
 
that should be in the page response
not in the .php includes
but in the html that goes to the page
 
I have top.php, and in top.php i have the <head> where i inserted your function
That should work?
 
11:55 PM
if($_GET['mode'] && $_GET['mode'] == 'new'){ ?>
<script>$(document).ready(function(){showfancybox();});</script>
that should be in the page pm.php
 
yes
 
put both of those and do the test again
 
nothing
happens
 
change

if($_GET['mode'] && $_GET['mode'] == 'new'){ ?>
<script>$(document).ready(function(){showfancybox( $(document) );});</script>
 
Nothing
 
11:58 PM
ok, well look here man, there's no reason for it to not fire, unless there's something about it has to attach to a particular type of element. put a link somewhere in your page for testing and attach it to that
 
I think it's because that normally you specify which div element to open in the href="" of an <a
 

« first day (21 days earlier)      last day (4932 days later) »