I'm a coder. Welcome to my blog. Here are some of the records on my job.

Categories

AJAX Not Printing What does PHP return&quest;

advertisements

So I am using ajax to print out a string received from my php file. The php file is creating rows for an html table. I am asking ajax to print these rows inside a with a specific id that is inside of a and i want it to print the rows when the page first loads up. My jQuery code is as follows:

I am not sure what I am doing wrong or why it is not printing out, I know it is using my php file because it returned errors in my php code before when I had bugs that I fixed, but now the bugs are fixed so there are no more errors, but the code still isn't being printed out. Please Help thank you!

Use $('#div1').html(result); instead. By $('#div1') you are getting the element as jQuery object, that's why it was not working.

Also, if you've json encoded htmlStr you should store the html in an array and then encode it. Like:

Related Articles

What does array_search() return if nothing was found? I have the need for the following logic: $found = array_search($needle, $haystack); if($found){ //do stuff } else { //do different stuff } Quoting the manual page of array_search() : Returns the k

I was willing to know what does putc() return. I was going through the following link:https://www.tutorialspoint.com/c_standard_library/c_function_putc.htm. Now if putc() returns EOF on error, then a natural question is what does it return on end of

I heard that Python has automated "garbage collection" , but C++ does not. What does that mean?That means that python user doesn't need to clean his dynamic created objects, like you're obligated to do it in C/C++. Example in C++: char *ch = new

Here is the working piece of code given as an answer to the question for implementing sorting of objects and it is working perfectly fine. As I am new to JavaScript I'm not understanding what exactly the return type does. Can anyone explain please? v

Today in my interview, the interviewer asked: printf is a function and every function returns something; int, void, float, etc. Now what does printf return as it's a function?int. On success, the total number of characters written is returned. On fai

This code works fine after commenting statement one. Statement two gives some garbage value but at least it runs. I'm not getting how does the printf in argument gives a value if it's not called as a function? #include<stdio.h> int main() { int prin

Getting these errors "Deprecated: Assigning the return value of new by reference is deprecated..." While I know what deprecated function means, but I am not very clear that what PHP does to them? Still execute them as usual? So at this point for

What does the code return do in a coding problem like: var creditCheck = function (income) { if (income>=100){ return ("You earn a lot of money! You qualify for a credit card."); } else { return ("Alas you do not qualify for a credit car

I'm looking at an example of how to use jqGrid, which is a jQuery plugin. It's drawing a grid in a div with an id of 'list'. It creates the grid with $('#list').jqGrid(...). But it populates the grid with $('#list')[0].addJSONData(...). I've been loo

The fine manual does not address what the str() method does when provided three arguments, as I've found in this code from requests/models.py: content = str(self.content, encoding, errors='replace') Where is this documented? What does it do?You're re

I haven't been able to find any examples of return values from the yield from expression. I have tried this simple code, without success: def return4(): return 4 def yield_from(): res = yield from range(4) res = yield from return4() def test_yield_fr

I have read the JQuery documentation, and while much attention is devoted to what you should pass the function, I don't see any information on what it actually returns. In particular, does it always return an array, even if only one element is found?