How to Print multidimension array in for loop ?

In this tutorial i’m going to share how to print multidimension array in for loop.

1st step got to your controller and put below code

public function getsocialurl($id){
        log::info('abhi in kiye hai be');
        log::info('trees in kiye hai be'.$id);
        $wizard_data = WebAcces::where('slug_id', $id)->get();
        log::info('wizard_data in kiye hai be'.$wizard_data);
        $response = [
            'success' => true,
            'data' => $wizard_data,
            'message' => 'gettings retrieved successfully.',
        ];
        return response()->json($response, 200);
    }

Next go to blade page and put below code

$.ajax({
                    type: "get",
                    data: {},
                    url: "{{ url('/api/v1/j/webaccess/wizards') }}/" + id,
                    headers: {
                        "Authorization": "Bearer " + localStorage.getItem('a_u_a_b_t')
                    },
                    success: function(response) {
                        var arrayLength = response.data.length;
                        console.log("Number of items in the array:", arrayLength);
                        // Loop through the array and print admin_id where it exists
                        for (var i = 0; i < arrayLength; i++) {
                            var item = response.data[i];
                            // var item = response.data[i];
                            if (item.facebooks) {
                                $('#facebook_value').val(item.facebooks);
                                console.log("admin_id me hai be:", item.facebooks);
                            }
                            if (item.slideshare) {
                                console.log("slideshare me hai be:", item.slideshare);
                            }
                            if (item.youtube) {
                                console.log("youtube me hai be:", item.youtube);
                            }
                            if (item.tiktok) {
                                console.log("tiktok me hai be:", item.tiktok);
                            }
                        }

                        // Access the data property of the response
                        var wizardData = response.data;
                        if (wizardData.length > 1) {
                            var facebooksData = wizardData[0].facebooks;
                            var tiktok_value = wizardData[0].tiktok;
                            var facebooksData = wizardData[0].facebooks;
                            var slideshare_value = wizardData[0].slideshare;
                            var youtube_value = wizardData[0].youtube;
                            var dailymotion_value = wizardData[0].dailymotion;
                            var twitter_value = wizardData[0].twitter;
                            var linkedin_value = wizardData[0].linkedin;
                            var instagram_value = wizardData[0].instagram;
                            var tumblr_value = wizardData[0].tumblr;
                            var wordpress_value = wizardData[0].wordpress;
                            var pinterest_value = wizardData[0].pinterest;
                            var reddit_value = wizardData[0].reddit;
                            var plurk_value = wizardData[0].plurk;
                            var debugschool_value = wizardData[0].debugschool;
                            var blogger_value = wizardData[0].blogger;
                            var medium_value = wizardData[0].medium;
                            var quora_value = wizardData[0].quora;
                            var professnow_value = wizardData[0].professnow;
                            var github_value = wizardData[0].github;
                            var hubpages_value = wizardData[0].hubpages;
                            var gurukulgalaxy_value = wizardData[0].gurukulgalaxy;
                            var mymedicplus_value = wizardData[0].mymedicplus;
                            var holidaylandmark_value = wizardData[0].holidaylandmark;
                            var facebook_page_value = wizardData[0].facebook_page;
                            $('#facebook_value').val(facebooksData);
                            $('#tiktok_value').val(tiktok_value);
                            $('#slideshare_value').val(slideshare_value);
                            $('#youtube_value').val(youtube_value);
                            $('#dailymotion_value').val(dailymotion_value);
                            $('#twitter_value').val(twitter_value);
                            $('#linkedin_value').val(linkedin_value);
                            $('#instagram_value').val(instagram_value);
                            $('#tumblr_value').val(tumblr_value);
                            $('#wordpress_value').val(wordpress_value);
                            $('#pinterest_value').val(pinterest_value);
                            $('#reddit_value').val(reddit_value);
                            $('#plurk_value').val(plurk_value);
                            $('#debugschool_value').val(debugschool_value);
                            $('#blogger_value').val(blogger_value);
                            $('#medium_value').val(medium_value);
                            $('#quora_value').val(quora_value);
                            $('#professnow_value').val(professnow_value);
                            $('#github_value').val(github_value);
                            $('#hubpages_value').val(hubpages_value);
                            $('#gurukulgalaxy_value').val(gurukulgalaxy_value);
                            $('#mymedicplus_value').val(mymedicplus_value);
                            $('#holidaylandmark_value').val(holidaylandmark_value);
                            $('#facebook_page_value').val(facebook_page_value);
                            // Display the facebooks data or perform other actions
                        } else {
                            console.error('No data found in the response.');
                        }
                    },
                    error: function(error) {
                        console.error('Error retrieving data:', error);
                    }
                })

Now output coming successfully .

Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

How to Crawl any website Meta Title and Meta Description in Laravel ?

1st step install below package. Next to create Controller First go to route and put below code Next go to controller and put below code Next go…

SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: insert into `oauth_clients` (`user_id`, `name`, `secret`

In this tutorial i’m going to solve the error SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: insert into oauth_clients (user_id, name, secret Error :-…

Top 20 Laravel Interview Question in 2024

In this tutorial im going share interview experience For laravel developer. A list of top frequently asked Laravel Interview Questions and answers are given below. Q #1) What is…

How to Get Google Analytics API key ?

In this tutorial we’re going to share how to get the google Analytics API key. I have shared in very easy way. First go enable Google analytics…

Youtube Subscriber Count in ReactJs

In this tutorial i’m going to learn how to count YouTube Subsribers count, views count as well, as define below. In order to install your app, first…

How to Disable Laravel’s Eloquent timestamps in laravel ?

In this tutorial we’re going to share how to disable the automatic created_at and updated_at timestamps in Laravel’s Eloquent models, along with explanations of different scenarios: 1st…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x